PHP 5.3.0 installation on Windows (xampp)¶
Deutsche Übersetzung bei A.BE.ZET
Introduction¶
FLOW3 requires PHP 5.3 as minimum version. Now this is available as a Stable version. So you won't find it in packages like xampp. You'll have to install it yourself.
This tutorial shows you how to install PHP 5.3 additional to your existing PHP-Version. So you can use the stable version for other projects than FLOW3. Use port 81 in the URL to get the new PHP-Version.
The steps in this tutorial are based on a standard xampp installation. It has been installed in the folder C:\xampp\. If your xampp is placed in another folder, you'll have to adjust some paths in this instructions.
Quicksteps (if you don't need additional explanations):¶
- Download php-5.3-win32-VC6-x86-latest.zip from the "windows-binaries-download-page": http://windows.php.net/snapshots/#php-5.3-ts-VC6-x86
- Unzip it to the folder C:\xampp\php\conf-php5.3.0\
- Copy folder C:\xampp\apache\conf\ to C:\xampp\apache\conf-php5.3.0\
- Create folder C:\xampp\apche\logs-php5.3.0\
- Change configuration files in the new folder conf-php5.3.0\:
- httpd.conf:
Listen 81- Search/replace: conf/ to conf-php5.3.0/
- Search/replace: logs/ to logs-php5.3.0/
- extra\httpd-ssl.conf:
Listen 4343- extra\httpd-xampp.conf:
- remove
LoadModule php5_module "C:/xampp/apache/bin/php5apache2.dll"- add these lines:
LoadFile "C:/xampp/php/php5.3.0/php5ts.dll" LoadModule php5_module "C:/xampp/php/php5.3.0/php5apache2_2.dll" PHPIniDir "C:/xampp/php/php5.3.0"- extra\httpd-vhosts.conf: adjust port and VirtualHosts
- php5.3.0: copy php.ini-dist to php.ini
- php.ini:
- Activate Extensions php_mbstring and php_pdo_sqlite
extension_dir = 'C:\xampp\php\php5.3.0\ext\'(caution: single quotes!)magic_quotes_gpc = Off- start apache (prompt):
apache -f .\conf-php5.3.0\httpd.conf- or install as a service:
apache -k install -n Apache2.2-php5.3.0 -f .\conf-php5.3.0\httpd.conf
Download and unzip PHP¶
Download the windows binaries. You need the file php-5.3-win32-ts-VC6-x86-latest.zip from the "windows-binaries-download-page": http://windows.php.net/snapshots/#php-5.3-win32-ts-VC6-x86.
Add a folder php5.3.0 inside the folder C:\xampp\php\. Extract the content of the zip-file into this new folder.
Apache Configuration¶
Later you will start another apache process that should have its own configuration and its own log files.
So, what you do first, is- Copy the folder C:\xampp\apache\conf\ to C:\xampp\apache\conf-php5.3.0\.
- Create a new folder C:\xampp\apche\logs-php5.3.0\.
In the following steps change the configuration files in the new folder conf-php5.3.0\.
httpd.conf¶
- Change the port from 80 to 81:
Listen 81
- Adjust the includes of the configuration files:
Search for conf/ and replace it with conf-php5.3.0/.
- Adjust the log file directory:
Search for logs/ and replace it with logs-php5.3.0/.
- Add the configuration for using another PidFile (otherwise you might get some more entries in the error-log) by adding the following line. A good place is below ServerRoot:
PidFile logs-php5.3.0/httpd.pid
- Activate the module mod_rewrite by uncommenting the line:
LoadModule rewrite_module modules/mod_rewrite.so
extra\httpd-ssl.comf¶
Change the SSL-Port: Listen 4343
extra\httpd-xampp.conf¶
Here you tell the apache which .dll-files it should use as PHP-module.
- Revome or uncomment this line:
LoadModule php5_module "C:/xampp/apache/bin/php5apache2.dll"
- Add the following lines:
#php5.3.0 settings: #Preload the PHP interpreter dll so that apache can find it, even if it's not in the path LoadFile "C:/xampp/php/php5.3.0/php5ts.dll" #Load the sapi module for Apache LoadModule php5_module "C:/xampp/php/php5.3.0/php5apache2_2.dll" #Specify the directory that the php.ini is stored in PHPIniDir "C:/xampp/php/php5.3.0"
extra\httpd-vhosts.conf¶
Configure the VirtualHosts. Make them reference to the Public-folder of your FLOW3 installation.
NameVirtualHost *:81
<VirtualHost *:81>
DocumentRoot "C:/xampp/htdocs/"
ServerName localhost
</VirtualHost>
<VirtualHost *:81>
DocumentRoot "C:/xampp/htdocs/blog/Public/"
ServerName blog.flow3.local
</VirtualHost>
Configure PHP¶
Copy the file C:\xampp\php\php5.3.0\php.ini-dist in the same folder and rename it to php.ini. There change the following things:
- Activate some extensions FLOW3 needs:
extension=php_mbstring.dll extension=php_pdo_sqlite.dll
- Set the folder, where the extensions are stored:
extension_dir = 'C:\xampp\php\php5.3.0\ext\'
Caution You need to use single quotes here as PHP 5.3 doesn't like double quotes (though the examples still use them...)
- FLOW3 will ask you to deactivate magic quotes, so just do it:
magic_quotes_gpc = Off
Start the (second) Apache¶
Just start it using the prompt¶
Open a DOS prompt and switch to the folder C:\xampp\apache\bin\.
Start the apache telling him the other configuration file:apache -f .\conf-php5.3.0\httpd.conf
Don't close the prompt.
You can stop the apache with the key combination CTRL+v in the prompt.
Install as a service¶
Open a DOS prompt and switch to the folder C:\xampp\apache\bin\.
Install the service:apache -k install -n Apache2.2-php5.3.0 -f .\conf-php5.3.0\httpd.confNow you can start the service using the service-administration in the Windows control panel or in the prompt:
net start Apache2.2-php5.3.0
Verify the Success¶
Call phpinfo() for both ports:Check, if the PHP-version is correct and the right php.ini is used.
Solve Problems¶
If you have problems starting the apache, there are two places that mostly help solving them:- Check the error-log of the apache. (Did you choose the right log-file (you should see the start of the apache in their)?)
- Have a look at the events in the Windows control panel. Usually you find more detailled information here than in the error-log if the apache crashed.