Home > Article > Backend Development > Three steps to solve the problem of setting up a PHP environment_PHP tutorial
Build it correctly
Build a PHP environment 1. Install Apache 2.2.x
Download address: http:// /httpd.apache.org/
Press Enter all the way to install. Note that after the installation is completed, execute: D:Apache2.2bin>httpd -k install
Assume that it is installed under the D: drive.
Installing the Apache2.2 service
The Apache2.2 service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started .
httpd: Could not reliably determine the server's fully qualified domain name, us
ing 192.168.28.100 for ServerName
After execution, open Monitor Apache Servers in the lower right corner of the desktop and start the Apache 2.2 service
Build a PHP environment 2. Install PHP
Download address: http://cn2.php.net/get/php-4.4.9 -Win32.zip/from/a/mirror
Download php-5.2.6-Win32.zip
(1) Extract the PHP file to a directory, the directory address is "D: php".
(2) Copy php.ini-dist under the PHP directory (D:php) to the windows (some systems are winnt directory) directory, and rename it to php.ini.
(3) Copy all dll files in the D:php directory to the windows system folder, that is: C:windowssystem32.
Note: If you don’t want to copy the files in (3), you can add the D:php directory to the system PATH variable
Building a PHP environment 3. Integration of Apache and PHP
Go to the Apache HTTP Server 2.2.4 of the program in the start menu, and then enter the next level of Configure Apache Server. At this time, you can see the Edit the Apache httpd.conf Configuration File. Click.
Look for:
#LoadModule ssl_module modules/mod_ssl.so
Add below:
LoadModule php5_module "d:/local/php/php5apache2_2.dll"
Look for:
DirectoryIndex index .html
Replace:
DirectoryIndex index.html index.htm index.php default.php
Find:
AddType application/x-gzip .gz .tgz
Add below:
AddType application/x-httpd-php .php
Apache configuration is completed, now start PHP configuration, use Notepad to open C:windowsphp.ini.
Find:
extension_dir = "./"
Replace:
extension_dir = "d:/local/php/ext/"
Find:
upload_max_filesize = 2M
here means to modify the maximum limit of uploaded files. The default is 2M and can be changed to 6M.
Find:
;extension=php_mbstring.dll
Remove the ";" sign in front.
Find:
;extension=php_gd2.dll
Remove the ; sign in front.
Look for:
;extension=mysql.dll
Remove the ; sign in front.
Search:
;date.timezone =
Replace:
date.timezone = PRC
The file is modified. At this time, double-click the Apache icon on the taskbar in the lower right corner. In the pop-up window, Click Stop to stop the service, and then click Start to start the service. At this time, you can see that "Apache/2.2.4 (Win32) PHP/5.2.0" is displayed in the status bar of the window. All configurations for setting up a PHP environment are completed.