Solved

PHP and Databases

Posted on 2006-07-21
10
567 Views
Last Modified: 2013-12-12
I just started a project and one of my tasks is to configure IIS6, php 5, and mysql 5.0 on a Windows 2003 Server.  IIS, php, and mysql were all installed by someone else, however there weren't any configurations made yet to any of these when I started the project.  I followed all install guides for these technologies but now am getting a "CGI Timeout The specified CGI application exceeded the allowed time for processing. The server has deleted the process." error message for ANY attempt to view a php page through a browser window.  Can someone tell me what the problem might be????
0
Comment
Question by:bbferris
10 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17157226
how long does the page need to load? IIS has a default of 30 seconds (if I remember correctly), which you can increase, but you should really check why this takes so long.
if it is really a process that needs to take really longer, make it a background processes running on the server, and display the page immediately, and let the user get notified by the script somehow that the process is finished.
0
 

Author Comment

by:bbferris
ID: 17157278
I was testing it with the basic "hello world" php test page....nothing that should take long to load.  I will attemp to change the timeout in IIS but I don't think that is the issue:(
0
 

Author Comment

by:bbferris
ID: 17157329
Nope.... not a change:(
0
 

Author Comment

by:bbferris
ID: 17157503
Still working on this.....

1. I changed the Environment Variables path configuration in IIS to include c:\PHP at the end of the path string (with a semicolon) instead of it's original location at the front of the path string.

2.  Next, I changed the Web Service Extension for .php from "C:\PHP\PHP.EXE" to "C:\PHP\PHP5ISAPI.DLL" and then removed the PHP5ISAPI extetion definition all together.

3. Last, I changed the .php application ext in website properties to point to "C:\PHP\PHP5ISAPI.DLL" instead of "C:\PHP\PHP.EXE" and also removed the php5isapi extension definition.  

At this point, I see this message:

Fatal error: Call to undefined function mysql_connect() in c:\Inetpub\wwwroot\support\inc\inc_db.php on line 6

I have the extension=php_mysql.dll uncommented in my php.ini file and have now copied C:\PHP\LIBMYSQL.DLL to my C:\WINDOWS\SYSTEM32 directory but I am still seeting the above fatal error?????
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:bbferris
ID: 17158221
I finally got this to work after restarting IIS
0
 
LVL 1

Expert Comment

by:fourjohn
ID: 17188628
Switching over from using CGI to ISAPI.DLLs is a good move.  However, you should not have to duplicate/copy DLLs to other Windows directories.

I just got things working today with my PHP 5, MySQL 5, Windows Server 2003 +IIS 6 installation.  I'll list my install steps here and you can pick apart what you might need.  This assumes a fresh installation of Windows Server 2003.  

The one major issue that I had to uncover was some obsure situation with how the mysql.dll and mysqli.dll files are created on mysql.com's website.  They used version 7 of Visual Studio to create the DLLs.  Netframework 2.0 is looking for DLLs created in version 8 or some weird garbage like that.  I don't understand it completely, but the solution is to copy the msvcr71.dll from your C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 directory to your c:\php directory.  You can also find the file on the net if you Google it.  Interestingly, previous to this I was able to get the mysql.dll and mysqli.dll files loaded from the original PHP install files (without need the msvcr71.dll in the PHP directory), however, they are not 100% compatible (as is documented elsewhere).

BE SURE THAT YOU ARE USING THE MYSQL.DLL AND MYSQLI.DLL FILES FROM MYSQL.COM AND NOT FROM THE ORGINAL PHP INSTALLATION FILES!  They are several incompatibilities.

There are severals additional steps not listed below which I have to verify seperately, but I know for a fact the steps are a bare minimum to get things working.  Issues like granting the IUSER user permissions on the various web directories have not been verified yet.  Also, turning off Windows Server 2003's "Data Execution Prevention (DEP)" program may be a helping factor as well as a possible issue with the Windows Firewall.

======================================================
FILES TO HAVE ON HAND AND DIRECTORIES TO COPY THEM TO:
1.  MySQL Essentials
2.  PHP files (not the installer version)
3.  PHP MyAdmin
4.  MySql Administrator
5.  MySQL.dll (PHP download from MySql.com) (c:\php\ext directory)
6.  MySQLi.dll (PHP download from MySql.com) (c:\php\ext directory)
7.  libmysql.dll (PHP download from MySql.com) (c:\php directory)
8.  msvcr71.dll (copy from C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 or Google it) (c:\php directory)
9.  test.php (create blank php file and type <?php phpinfo();?> then save) (C:\Inetpub\wwwroot directory)
======================================================

INSTALLATION STEPS:
1.  Install IIS (Add/Remove Windows Components)
2.  Unzip PHP files to C:\PHP directory
3.  Go to PHP directory and rename php.ini-recommended to php.ini
4.  Open php.ini
5.  Locate extension_dir = "./" and change to extension_dir = "c:\php\ext"
6.  Locate Dynamic Extensions section and remove semicolon before the following lines:
    ;extension=php_mbstring.dll
    ;extension=php_mysql.dll
7.  Add the following line in the Dynamic Extensions section:
    extension=php_mysqli.dll
8.  Save and close php.ini
9.  Copy php.ini to the c:\windows directory (Windows does not find it anywhere else even though the system path is specified in the next step)
10.  Add proper folders to the system path:
     a.  Start, right-click My Computer and select Properties
     b.  Click Advanced tab then click Environment Variables
     c.  Locate Path variable in the System Variables section
     d.  Click Edit and go to the end of the Variable value text box.
     e.  Add the following to the end and be sure to add the leading semicolon:
         ;c:\php;c:\php\ext
     f.  Close the dialog boxes.
11.  Open the IIS Manager
12.  Right click the Web Service Extensions folder and select "Add a new Web service extension..."
13.  Enter PHP ISAPI Extension for the Extension Name
14.  Click the Add button and enter c:\php\php5isapi.dll.  Click OK.
15.  Click once on "c:\php\php5isapi.dll" to highlight it and then click the check box next to "Set extension status to Allowed".  Click OK.
16.  Right-click the Web Sites folder and select Properties.
17.  Select the Home Directory tab and click the Configuration button.
18.  Click the Add button and enter c:\php\php5isapi.dll in the Executable field
19.  In the Extension field type .php
20.  Click the radio button next to "Limit to:" and enter GET,POST,HEAD (no spaces).  Click OK twice.
21.  Click the Documents tab and click the Add button.
22.  Type index.php in the field and click OK.
23.  Select index.php in the list and click the Move Up button until it is at the top of the list.  Click OK and click OK a second time if an "Inheritance Overrides" dialog box appears.
24.  Right-click the computer name in IIS Manager and choose "All Tasks" then "Restart IIS...".  Click OK on the "Stop/Start/Restart..." dialog box making sure "Restart IIS Services on (computername)" is selected.
25.  Close IIS Manager
26.  Copy the test.php file to the C:\Inetpub\wwwroot directory
27.  Open Internet Explorer and visit http://localhost/test.php to ensure a PHP configuration screen appears.
28.  Copy the MySQL.dll and MySQLi.dll files to the c:\php\ext directory.  Overwrite the existing files.
29.  Copy the libmysql.dll and msvcr71.dll files to the c:\php directory.  Overwrite the existing libmysql.dll file.
30.  Run the MySQL Essentials installer file.
31.  Choose a Custom installation.  Change the installation folder to c:\mysql and install.
32.  Choose to Skip Sign-Up on the MySQL.com Sign-Up screen.
33.  Make sure the check box next to "Configure the MySQL Server now" is checked and click Finish.
34.  The MySQL Server Instance Configuration Wizard should appear.  Click Next.
35.  Choose a Standard Configuration and click Next.
36.  Check the boxes next to "Install As Windows Service", "Launch the MySQL Server automatically", and "Include Bin Directory in Windows PATH".  Make sure the drop down next to Service Name is set to MySQL.  Click Next.
37.  Enter a root password twice.  Leave "Enable root access from remote machines" unchecked.  Click Next.
38.  Click Execute.  After success click Finish to close the wizard.
39.  Open Internet Explorer and visit http://localhost/test.php.  Scroll down and make sure you see sections for MBSTRING, MYSQL, AND MYSQLI.  If you do not see these sections it means the DLLs are not being loaded correctly by PHP.  If you do see these sections, check to make sure the version information for MYSQL and MYSQLI all say 5.0.22 (PHPs original MYSQLI Client API header version will show 4.1.7 which is not 100% compatible).
40.  Unzip the PHPMyAdmin files to the C:\Inetpub\wwwroot\phpmyadmin directory
41.  Open Internet Explorer and open http://localhost/phpmyadmin/scripts/setup.php
42.  Under the Servers section (top entry) click the Add button
43.  Enter the following information:
     Server hostname - "computer name"
     Server port - "3306"
     PHP extension to use - "MySQLi"
     Authentication type - "Config"
     User for config auth - "root"
     Password for config auth - "same as MySQL installation"
     phpMyAdmin control user - "root"
     phpMyAdmin control user password - "same as MySQL installation"
     phpMyAdmin database for advanced features - "phpmyadmin"
44.  Click the Add button.
45.  On the confirmation screen go down to the configuration section and click the download button.
46.  Save the file as config.inc.php to the C:\Inetpub\wwwroot\phpmyadmin directory
47.  Open Internet Explorer and visit http://localhost/phpmyadmin.  If PHPMyAdmin appears with no errors it means that PHP and MySQL are now working together on Windows Server 2003!

Hope this helps.
0
 
LVL 1

Expert Comment

by:fourjohn
ID: 17200763
Actually, I went through and did a fresh installation today from scratch and came across a few minor issues with my previous steps.  Here are my revised steps.  Some are a change of order and some steps are further explained.

Here you go:

======================================================
FILES TO HAVE ON HAND AND DIRECTORIES TO COPY THEM TO:
1.  MySQL Essentials
2.  PHP files (not the installer version)
3.  PHP MyAdmin
4.  MySql Administrator
5.  MySQL.dll (PHP download from MySql.com) (c:\php\ext directory)
6.  MySQLi.dll (PHP download from MySql.com) (c:\php\ext directory)
7.  libmysql.dll (PHP download from MySql.com) (c:\php directory)
8.  msvcr71.dll (copy from C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 or Google it) (c:\php directory)
9.  test.php (create blank php file and type <?php phpinfo();?> then save) (C:\Inetpub\wwwroot directory)
======================================================

INSTALLATION STEPS:
1.  Install IIS (Add/Remove Windows Components)
2.  Unzip PHP files to C:\PHP directory
3.  Go to PHP directory and rename php.ini-recommended to php.ini
4.  Open php.ini
5.  Locate extension_dir = "./" and change to extension_dir = "c:\php\ext"
6.  Locate Dynamic Extensions section and remove semicolon before the following lines:
    ;extension=php_mbstring.dll
    ;extension=php_mysql.dll
7.  Add the following line in the Dynamic Extensions section:
    extension=php_mysqli.dll
8.  Save and close php.ini
9.  Copy php.ini to the c:\windows directory (Windows does not find it anywhere else even though the system path is specified in the next step)
10.  Copy the MySQL.dll and MySQLi.dll files to the c:\php\ext directory.  Overwrite the existing files.
11.  Copy the libmysql.dll and msvcr71.dll files to the c:\php directory.  Overwrite the existing libmysql.dll file.
12.  Create the test.php file by creating a new text file.  Enter <?php phpinfo();?> on the top line and save it as test.php to the C:\Inetpub\wwwroot directory.
13.  Add proper folders to the system path:
     a.  Start, right-click My Computer and select Properties
     b.  Click Advanced tab then click Environment Variables
     c.  Locate Path variable in the System Variables section
     d.  Click Edit and go to the end of the Variable value text box.
     e.  Add the following to the end and be sure to add the leading semicolon:
         ;c:\php;c:\php\ext
     f.  Close the dialog boxes.
14.  Open the IIS Manager
15.  Right click the Web Service Extensions folder and select "Add a new Web service extension..."
16.  Enter PHP ISAPI Extension for the Extension Name
17.  Click the Add button and enter c:\php\php5isapi.dll.  Click OK.
18.  Click once on "c:\php\php5isapi.dll" to highlight it and then click the check box next to "Set extension status to Allowed".  Click OK.
19.  Right-click the Web Sites folder and select Properties.
20.  Select the Home Directory tab and click the Configuration button.
21.  Click the Add button and enter c:\php\php5isapi.dll in the Executable field
22.  In the Extension field type .php
23.  Click the radio button next to "Limit to:" and enter GET,POST,HEAD (no spaces).  Click OK twice.
24.  Click the Documents tab and click the Add button.
25.  Type index.php in the field and click OK.
26.  Select index.php in the list and click the Move Up button until it is at the top of the list.  Click OK. If an "Inheritance Overrides" dialog box appears, click the "Select All" button to highlight all of the child nodes and then click OK.
27.  Right-click the computer name in IIS Manager and choose "All Tasks" then "Restart IIS...".  Click OK on the "Stop/Start/Restart..." dialog box making sure "Restart IIS Services on (computername)" is selected.
28.  Close IIS Manager.
29.  Open Internet Explorer and visit http://localhost/test.php to ensure a PHP configuration screen appears.  Scroll down and make sure you see sections for MBSTRING, MYSQL, AND MYSQLI.  If you do not see these sections it means the DLLs are not being loaded correctly by PHP.  If you do see these sections, check to make sure the version information for MYSQL and MYSQLI all say 5.0.22 (PHPs original MYSQLI Client API header version will show 4.1.7 which is not 100% compatible).
30.  Run the MySQL Essentials installer file.
31.  Choose a Custom installation.  Change the installation folder to c:\mysql and install.
32.  Choose to Skip Sign-Up on the MySQL.com Sign-Up screen.
33.  Make sure the check box next to "Configure the MySQL Server now" is checked and click Finish.
34.  The MySQL Server Instance Configuration Wizard should appear.  Click Next.
35.  Choose a Standard Configuration and click Next.
36.  Check the boxes next to "Install As Windows Service", "Launch the MySQL Server automatically", and "Include Bin Directory in Windows PATH".  Make sure the drop down next to Service Name is set to MySQL.  Click Next.
37.  Enter a root password twice.  Leave "Enable root access from remote machines" unchecked.  Click Next.
38.  Click Execute.  After success click Finish to close the wizard.
39.  Unzip the PHPMyAdmin files to the C:\Inetpub\wwwroot\phpmyadmin directory
40.  Open Internet Explorer and open http://localhost/phpmyadmin/scripts/setup.php.  Don't worry about the error message saying "Cannot load or save configuration" or "Not secure connection".
41.  Under the Servers section (top entry) click the Add button
42.  Enter the following information:
     Server hostname - "localhost"
     Server port - "3306"
     Server socket - leave blank
     Connection type = "TCPIP"
     PHP extension to use - "MySQLi"
     Compress connection - unchecked
     Authentication type - "Config"
     User for config auth - "root"
     Password for config auth - "same as MySQL installation"
     Only database to show - leave blank
     Verbose name of this server - leave blank
     phpMyAdmin control user - "root"
     phpMyAdmin control user password - "same as MySQL installation"
     phpMyAdmin database for advanced features - "phpmyadmin"
43.  Click the Add button.
44.  On the confirmation screen go down to the configuration section and click the download button.
45.  Save the file as config.inc.php to the C:\Inetpub\wwwroot\phpmyadmin directory.  YOU WILL NEED TO CHANGE THE "SAVE AS TYPE" DROP DOWN TO "ALL FILES" otherwise Internet Explorer will save the file as config.inc.php.txt instead of just config.inc.php
46.  Open Internet Explorer and visit http://localhost/phpmyadmin.  If PHPMyAdmin appears with no errors it means that PHP and MySQL are working together on Windows Server 2003!

Good luck!
0
 
LVL 1

Expert Comment

by:fourjohn
ID: 17750129
Similar to my other posting on a related topic, for my part all I can say is that I offered a complete beginning to end step-by-step solution for the specific problem.

Thanks,
John
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 17780269
PAQed with points refunded (500)

CetusMOD
Community Support Moderator
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now