1. Installation of PHP 5.2.5 using Apache
≡
1. Download php-5.2.5-Win32.zip from its official website and unzip it (it is said: Do not download And use its Installer. Although this method is very automatic and intelligent, it also has many limitations, because it is not recommended. ) to a directory "D:PHPPHP".
Copy php.ini-recommended under the PHP directory (D:PHPPHP) to the windows (some systems are winnt directory) directory, rename it to php.ini, find extension_dir, and change it to extension_dir=" D:PHPPHPext". In fact, the same effect can be achieved using php.ini-dist, but it is recommended to use php.ini-recommended because this file optimizes the performance and security of the default settings.
PHP.ini part description:
default_charset="gb2312", modify the default character set. Here, if there is a semicolon ";" in front of it, remove the semicolon;
register_globals=Off and change it to register_globals=On , making the passing of global variables valid;
extension=php_dba.dll If there is a semicolon in front, cancel the semicolon, the same as below;
extension=php_dbase.dll
extension=php_gd2.dll GD library for drawing, generally Used for graphical verification code;
extension=php_mysql.dll is used to connect to MYSQL database;
short_open_tag=On supports and …?>, Off means only < ?php…?>
Copy the php5ts.dll and libmysql.dll (used to support mysql) files in the D:PHPPHP directory to the windows system folder, that is: C:windowssystem32.
≡ Installation of Apache 2.2.8 ≡
1. Download apache_2.2.8-win32-x86-no_ssl.msi from its official website and execute it.
Press the Next button 3 times. The installation program requires you to enter your Network Domain (network domain name), Server Domain (server domain name) and website administrator's email. If there is any, fill it in truthfully. This description introduces the local I built my own test environment, so just casually, fill in localhost for the first two, and write your own in the email.
After entering Next, the default installation path is "C:Program FilesApache Software FoundationApache2.2". Modify the path to "D:PHPApache2.2" you want.
Then go all the way until the installation is complete; at this time, open the PHP folder under the D drive and you can see a folder named Apache2.2.
2. Open IE and enter: "http://localhost" or "http://127.0.0.1" in the address bar. You can see the successful page of Apache installation completion;
3. Configuration of the conf/httpd.conf file
1) Search for "DocumentRoot", which is the directory where the specified homepage is placed. The default is: "D:PHPApache2.2htdocs". You can use the default directory or define one yourself, such as: "D:/PHP". Note: Do not add "/" at the end of the directory.
2) Search for "DirectoryIndex", which is the default home page file name. You can add index.php, etc. after index.html. Multiple file names are separated by spaces.
3) Find
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Modify For:
Options FollowSymLinks
AllowOverride None
Order deny,allow
allow from all
If you don’t change this , an error message like You don't have permission to access / on this server. may appear, especially after changing the path of the default homepage.
4) Create a virtual directory
Find
Add Alias /webpath "D:PHPApache2.2phptxt"
Options MultiViews
AllowOverride None
Order allow,deny
Allow from all
where /webpath is the name of the virtual directory, "D :PHPApache2.2phptxt" is the file storage location.
The accessed address is: http://localhost/webpath/
5) Make the server support PHP and add the following two lines of code at the corresponding location
LoadModule php5_module "D:PHPPHPphp5apache2_2.dll"
AddType application/x-httpd-php .php .php3 .inc
Note: The httpd.conf file needs to be restarted to take effect.
2. Use IIS to parse PHP files
1. Same as above, first install PHP 5.2.5.
2. Open IIS Manager, select "Default Website" -> "Properties", select the "Home Directory" priority card in the pop-up dialog box, change the execution permission to "Scripts and Executable Files", click " Configuration", add application extension mapping, select "D:PHPPHPphp5isapi.dll" for the executable file, the extension ".php", select all actions, script engine, and confirm whether the file exists.
If it is a win2003 system, you also need to add a web service extension. The required file is "D:PHPPHPphp5isapi.dll", the extension is "PHP", and the status is changed to allow.