can anyone tell us why Apache 2.2 refuses to find PHP5's libmysql.dll and hence php_mysqli.dll load fails. libmysql.dll is in c:/php and c:/php is in the windows system path, but ti ddoesn't work. My kludge-around is to copy libmysql.dll to c:/windows/system32. Don't like doing it but it works. Anyone shed some light?

Comments

tm’s picture

I put (drive letter):\php and (drive letter):\php\ext in my Windows environment global path (need to restart Windows to take effect), and both dll files are in the \ext folder. Oh, my "extention_dir" variable in php.ini is "./ext/", so you can adjust that and the env path for your own installation. Actually have the include_path variable commented out. I am using Apache HTTP 2.2.4, PHP 5.2.1 and MySQL 5.0.37; it works for me. I am sure someone can improve on this.

You may wish to use the MySQLi connectors for Windows from the MySQL site; I have had problems in the past with the set delivered with PHP.

twohills’s picture

isn't it frightening what you miss when you have been workign on somethign too long!! thankyou, you pointed me to what was too obvious for me to notice. The PHP Windows installer adds c:\php in the PATH variable but not c:\php\ext!

tm’s picture

It's a Windows thing; do not trust the "automatics." I try not to use the installer (get the zip file); dump the files into a folder, and set my own variables. Keeps me in touch, takes the "assume" out of the equation, and I cannot blame anyone but myself if something goes wrong.

Only wish my typing was better, though. So many problems due to typos...

ShutterFreak’s picture

The following installation instructions worked for me:

Install the Apache 2.2 webserver

  1. Download the Apache Win32 installer to the Desktop: http://apache.belnet.be/httpd/binaries/win32/apache_2.2.4-win32-x86-no_ssl.msi
  2. Run the Apache installer (double-click on the icon)
  3. A warning "The publisher could not be verified" will appear. Click "Run" to start the Apache installer.
  4. On the "Welcome to the Installation Wizard for Apache HTTP Server 2.2.4" screen, click "Next"
  5. Accept the terms and conditions (Apache License) , and click "Next".
  6. On the "Read This first" screen, click "Next"
  7. On the "Server Information" screen, make sure the Network Domain, Server Name and Administrator's Email Address are valid/correct. Install Apache for all users, on Port 80, as a Service. Click "Next".
  8. On the Setup Type screen, choose "Custom", and click "Next".
  9. On the Custom Setup screen, click on the white pull-down button left of the top entry (Apache HTTP Server 2.2.4), and choose the 2nd possibility: "This feature, and all subfeatures, will be installed on local hard drive".
    • Install dir: C:\Program Files\Apache Software Foundation\Apache2.2
  10. Click "Next"
  11. Click "Install"
  12. Click "Finish" to close the Apache installation Wizard.
  13. Test the Apache installation by entering http://localhost/ (replace 'localhost' with the server if on a remote machine). A successful installation will display a page containing "It Works!").

Install PHP 5.2

  1. Download the PHP Win32 installer to the Desktop: http://be2.php.net/get/php-5.2.2-win32-installer.msi/from/this/mirror
  2. Run the installer (php-5.2.2-win32-installer) (double-click on the icon)
  3. A warning "The publisher could not be verified" will appear. Click "Run" to start the PHP installer.
  4. On the "Welcome to the PHP 5.2.2 Setup Wizard" screen, click "Next"
  5. Accept the PHP License and click "Next"
  6. Choose the default value for installing PHP: C:\Program Files\PHP and click "Next"
  7. In the "Web Server Setup" screen, choose "Apache 2.2.x Module" and click "Next"
  8. In the "Apache Configuration Directory" screen, click on "Browse" and browse to C:\Program Files\Apache Software Foundation\Apache2.2\conf for the Apache Configuration Directory. Click "Next".
  9. On the "Choose Items To Install" screen, make sure all "Extensions" and all "Extras" are installed (from the pull-down button to the left of both items, select: "Entire feature will be installed on local hard drive"). Leave "Program" and "Web Server Setup" unchanged.
  10. Click "Install" to start the installation of PHP.
  11. Click "Finish" to close the PHP installation Wizard.
  12. In order to read the PHP settings, restart the Apache webserver: locate the Apache icon in the right of the task bar (a red feather and a white dot), left-click on it, follow "Apache 2" and choose "Restart".
  13. Test the PHP installation
    • Create a text file named info.php in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs and write the following PHP code in it:
      <?php phpinfo(); ?>
    • Save this file, and browse to http://localhost/info.php (replace localhost with the real server name if on a remote machine). If you see a lengthy web page showing the status of the PHP installation (PHP Version 5.2.2), the Apache/PHP installation was successful.

Configure PHP

  1. Open the PHP configuration file: C:\Program Files\PHP\php.ini
  2. Check the following configuration parameters:
    1. upload_max_filesize = 20M (choose a value that will work for your site)
    2. session.save_handler: user
    3. date.timezone = Europe/Brussels (select your time zone here - some mailers refuse to operate if this is NOt set)
    4. SMTP = valid.smtp.server.in.domain
    5. sendmail_from = admin.email@your.webserver.in.domain
    6. mysql.default_host = localhost (or specify the MySQL host if it runs on a different machine)
  3. At the end of the PHP.ini file, it is possible that all modules have been enabled. Disable all of them by prepending a semicolon (;) before every "extension=" entry, including the big list at the end of php.ini.
  4. Check that the following PHP extensions are enabled (Drupal does not need any other PHP modules if working with MySQL - some Drupal modules may require other PHP modules, though):
    1. extension=php_gd2.dll
    2. extension=php_mbstring.dll
    3. extension=php_mysql.dll

Configure Apache

  1. Open the Apache configuration file: C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf
  2. Make sure the URL Rewrite module is enabled. There should be no pound sign (#) in front of the line containing LoadModule rewrite_module modules/mod_rewrite.so
  3. Make sure AllowOverride is enabled:
    1. Look up the following section: <Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
    2. Search for "AllowOverride None" within that section, and replace "None" with "All"

Restart Apache after configuration of PHP and Apache

  1. In order to read the new Apache and PHP settings, restart the Apache webserver: locate the Apache icon in the right of the task bar (a red feather and a white dot), left-click on it, follow "Apache 2" and choose "Restart".
  2. Test whether the PHP modules were correctly installed by opening a web browser on http://localhost/info.php (replace 'localhost' with the server name if working remotely). There should be an entry for MySQL, mbstring and gd2.
twohills’s picture

Cool, thanks! That deserves to be a handbook page.

Note that C:/Program files or any path with spaces in it can still cause problems with some software, so I prefer to install Apache to C:/apache2 and PHP to C:/php

ShutterFreak’s picture

Browse once more to http://localhost/info.php (replace localhost with the real server name if on a remote machine). If you see a lengthy web page showing the status of the PHP installation (PHP Version 5.2.2), the Apache/PHP installation was successful. Lookup the value of "Loaded Configuration File". This is the PHP ini file that will be read by Apache.

If the "Loaded configuration File" is C:\WINDOWS\php.ini

Sometimes the PHP installer incorrectly sets the value of the PHPIniDir variable in the Apache configuration file (single instead of double backslashes, trailing backslashes). Another possibility is that the path is actually incorrect. In either case the PHP configuration file (php.ini) is not read (since the PHP installer does not create a php.ini file in C:\WINDOWS)

  1. Open the Apache configuration file (C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf)
  2. Locate the following snippet at the very bottom of this configuration file:
    #BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
    PHPIniDir "C:\Program Files\PHP\"
    LoadModule php5_module "C:\Program Files\PHP\\php5apache2_2.dll"
    #END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
    
  3. Edit the value of the PHPIniDir variable and the path in the LoadModule call (all backslashes must be doubled, and trailing backslashes must be removed):
    #BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
    PHPIniDir "C:\\Program Files\\PHP"
    LoadModule php5_module "C:\\Program Files\\PHP\\php5apache2_2.dll"
    #END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
    
  4. Save the Apache configuration file
  5. Restart the Apache web server

Browse again to http://localhost/info.php (replace localhost with the real server name if on a remote machine) and verify again the value of "Loaded Configuration File": it should now read "C:\Program Files\PHP\php.ini".