Note: This proper Configuration will solve any of the following errors below:

Note: If you follow each single step in this tutorial you should not have to move any files to C:\WINDOWS or C:\WINDOWS\system32, yes you heard me right! After hours of searching forums trying everything suggested I found I was following fake prophets. So don't pay attention to those self proclaim gurus in those forums, they are just throwing punches in the air without ever hitting the target.


MY Machine is using: Apache Server 2.2.6, Windows XP SP2, PHP 5.2.5, MYSQL SERVER 5.0

1. Make Sure you downloaded the right PHP zip file from www.php.net for Apache configuration download PHP 5.2.5 zip package:

Visual Example:


2. Unzip the PHP 5.2.5 zip package in the root (for newbies: root means at top level of your hardrive not inside a folder). I am using hardrive E: so I unzipped it there:

Visual Example:


3. Make a copy of the file php.ini-dist and rename it php.ini. Also put brackets around the php.ini-dist. I put place brackets around this just as a pre-caution to avoid Apache server from reading it. In actuality it should not because of the hyphen and the dist but just in case.

Visual Example:

 

4. Configuration of Apache http.conf file:

 

5. Configuration of the PHP.INI to use MYSQL: By default on PHP 5 mysql drivers are disabled, follow the steps below to enable them.

 

6. CREATING test.php or phpinfo.php: TEST.PHP and PHPINFO.PHP are the same thing, it is just the name that you wish to assign to the function <? phpinfo( ); ?> when you save it.


7. Type the following URL in your browser http://localhost/phpinfo.php. If you did all the 5 steps above correctly you should see the page below:

Visual Example:


Extremely Important: pay attention to the 2 values below in your test.php or phpinfo.php page.


Configuration File (php.ini) Path E:\WINDOWS

//comment: Configuration File (php.ini) Path this is where Apache expects the PHP.INI file to be by default but it does not have to be here E:\WINDOWS or C:\WINDOWS

Loaded Configuration File E:\PHP\php.ini
//comment: Loaded Configuration File is the Folder location where Apache is really loading the PHP.INI file from your computer. This has to match the location that you added to the HTTPD.CONF file in step 4. Example: PHPIniDir "E:/PHP"



8. TROUBLESHOOTING ERRORS:

  1. TEST.PHP or PHPINFO.PHP NOT DISPLAYING: if a blank test.php or phpinfo.php page is loaded to your browser without displaying error is because you created these pages using the PHP Short hand <? ?> ex: <? phpinfo( ); ?> .


    1. SOLUTION:
    2. To correct this problem use the complete PHP hand <?php ?> in your test.php or phpinfo.php page. Example of the complete syntax: <?php phpinfo( ); ?>
    3. PHP 5 by default turns off the PHP short hand <? ?>. You can turn on the short hand by going to you PHP.INI file, if you wish to use the short hand notation/syntax in your coding. Visual Explantion:



  2. MYSQL Connection ERROR mysql_connect()" : below I explain the steps that apache takes to load the PHP.INI file and how the PHP.INI tells apache where mysql drivers are located.
    1. Apache first look for the PHP.INI in the path location that you specify using PHPIniDir. Make sure your PHP.INI file is this location.


    2. Double checking PHP.INI:
      Tells apache to include the folder where mysql driver resides.


      which drivers to load from that folder (do not forget to remove semicolon in front of it ;)



      Note: Make sure the drivers are in the folder you specified in the PHP.INI file section "extension_dir "


    3. To make sure your PHP.INI file is configured correctly double click on the php.exe in your PHP folder. If you PHP.INI configuration is not correct you will see an error when PHP.EXE tries to launch, if you do not see an error just a black screen PHP.INI is working properly you can close the PHP.EXE window.


    4. Finally make sure the Test.php or PHPINFO.PHP is displaying the right location of your PHP.INI file.



      Note: this is the most important part of the Mysql, PHP and APACHE configuration that the php.ini file is getting loaded from the right location

 

Personal Comments: I come from the microsoft house and I am trying to make the transition to Open Source House. My fiance' and I spent hours troubleshooting why php.ini file was not getting loaded from the right location, why "Undefined function mysql_connect()" error kept popping up but no forum including those from respected websites like www.mysql.com, www.php.net, www.phpfreaks.com/ were any help to us. We also wondered when we did try certain changes suggested the phpinfo page was showing up blank. I am very disappointed at these forums for failing to explain in detail how to solve this problem. Many of the people in these forums gave bits and pieces but never good explanations to solve the puzzle. This is very unfortunate for the Open Source community in its competion with microsoft. Nobody in the microsoft house wants to spent as many hours as we had to, reading through documentation, forums that do a poor job for explaining the installation process etc. We all want to spent time building applications and having our projects done within the dead lines.

Note: If you followed each single step in this tutorial you do not have to move any files to C:\WINDOWS or C:\WINDOWS\system32, yes you heard me right don't pay attention to those self proclaim gurus in those forums, they are just throwing punches to the air without ever hitting the target.

 

Sign Guestbook View Guestbook

Counter
Hosted by www.Geocities.ws

1