As a phper, the basic php development environment configuration is the most basic skill. today, let's look at how to configure the php development environment in the win764-bit system. Apache
I. preparation phase
1: php
Php-5.5.13 Download link: http://windows.php.net/downloads/releases/php-5.5.13-Win32-VC11-x64.zip
We recommend Thread Safe (Thread security) V11 x64, that is, 64bit.
Now, the PHP installation package downloaded on the PHP official website contains the words VC11 or VC9. what is the meaning of this? what kind of installation package should we download?
In fact, the PHP official website provides the answer:
VC9 and VC11
More recent versions of PHP are built with VC9 or VC11 (Visual Studio 2008 and 2012 compiler respectively) and include improvements in performance and stability.
The VC9 builds require you to have the Visual C ++ Redistributable for Visual Studio 2008 SP1 x86 or x64 installed.
The VC11 builds require to have the Visual C ++ Redistributable for Visual Studio 2012x86 or x64 installed.
VC9 indicates that PHP of this version is compiled with VisualStudio2008, while VC11 is compiled with VisualStudio2012. This means
If you download the version of VC9, you need to first install VisualC ++ RedistributableforVisualStudio2008SP1,
If you download the version of VC11, you must first install VisualC ++ RedistributableforVisualStudio2012.
V11 is a component of Microsoft. if it is not installed, msvcr110.dll is lost.
Download link: http://www.microsoft.com/zh-CN/download/details.aspx? Id = 30679
Download 64bit. after installation, restart your computer.
2: apache2.4.9, Download link: http://www.apachelounge.com/download/
V11 and 64-bit are also recommended.
3: mysql 5.6.19, Download link: http://dev.mysql.com/downloads/mysql/
Also recommended mysql-5.6.19-winx64.zip
II. method/step
1: Install and install apache2.4.9(httpd-2.4.9-win64-vc11.zip)
Unzip the downloaded installation package: the httpd-2.4.9-win64-VC11.zip put it in its own installation directory (my Directory E: \ Apache24)
Then modify the configuration file http. conf (E: \ Apache24 \ conf \ http. conf)-open it with notepad.
(1) modify the root path of ServerRoot Apache:
(37 rows) ServerRoot "c:/Apache24" changed to => ServerRoot "E:/Apache24"
(2) modify ServerName your host name:
(Row 217) ServerNamewww.example.com: 80 remove the previous #. This attribute is required when Apache is started from the command line.
(3) modify the main folder directory accessed by DocumentRoot Apache, which is the location of php and html code files. The default path of Apache is under htdocs (E: \ Apache24 \ htdocs.pdf, which contains a simple access file index.html. You can modify the path by yourself. here, I will configure it in my new folder www (E: \ php \ www.
(Row 3) DocumentRoot "c:/Apache24/htdocs"
Change to =>
DocumentRoot "E: \ php \ www"
(4) modify the configuration of the entry File: In general, we use index.php?index.html#index.htm as the entry of the web project. Only index.html needs to be added to the access port of apachetings. of course, the settings of this entry file can be increased or decreased according to your own needs. if the requirements are strict, you can write only one index. php, so the entry in the project can only be index. php
(274 rows)
DirectoryIndexindex.html
Change to =>
DirectoryIndex index. php index.htm index.html
(5) set the serverscript Directory:
(Row 3) ScriptAlias/cgi-bin/"c:/Apache24/cgi-bin/" changed to => ScriptAlias/cgi-bin/"e:/Apache24/cgi-bin"
(6) (374 rows)
AllowOverride None
Options None
Require all granted
Change to =>
AllowOverride None
Options None
Require all granted
Then you can start Apache.
Start --- run, enter cmd, and open the command prompt. Go to the e: \ Apache24 \ bin directory and press enter httpd,
If no error is reported, you can test it (keep the command window open ).
Put index.html under the Apache24 \ htdocsdirectory in the e: \ php \ www Directory. "It works" appears when accessed by a browser. This means that apache has been correctly installed and started. You can also open a simple index.html file.
Note: Apache uses port 80 by default. if port 80 is occupied, Apache cannot be started. you can change the Apache port to solve this problem.
Change the port: Find the httpd. conf file (e: \ Apache24 \ conf \ httpd. conf) in the conf directory under the Apache installation directory ). Open it. Find "Listen80", and the number of Listen is the port number. we will change it to "Listen 8080 ". You can also change it to another unused port number .. Restart Apache to make the new configuration take effect. You can use "Apache Serive Monitor" in the lower-right status bar to start apache. You can also click start> Run> enter cmd> Press Enter> go to the apache installation directory to go to the bin directory, and then enter httpd-k start ".
Add Apache to the window service startup item and set it to boot
Close the httpd service first (close the command window)
Open a new command window and go to the E: \ Apache24 \ bin directory:
The command to add the HTTP service is: httpd.exe-kinstall-n "servicename" servicename is the service name. what I add is: when the httpd.exe-k install-n "Apache24" command is successful, a prompt is displayed. you can view the Apache24 service in the window service startup item.
Or (e: \ apache24 \ bin \ httpd.exe-k install)
In this case, if you see: Installing the Apache2.4 service (OS 5), access is denied. : AH00369: Failed to open the WinNT service manager, perhaps you forgot to log in as Adminstrator? This error occurs because the downloaded file is in zip format when Apache is installed. if it is not an msi installation version, you must register your own service to have the httpd icon in the desktop taskbar. As a result, an error occurred while entering the installation command in the cmd command line. The error message shows that I did not log on as an administrator!
Solution: run cmd as an administrator and then enter the command again. after successful execution, you can find the Apache24 service in the system service.
Click Start. if you do not want to set it to boot, you can change the start type to manual.
If you want to uninstall the service, stop the service first. Then, enter httpd.exe-k uninstall-n "Apache24" to uninstall the service.
Of course, you can also start Apache using apachemonitor.exe under E: \ Apache24 \ bin.
The Apache configuration is complete.
2: install php5.5.13(php-5.5.13-win32-vc11-x64.zip)
(1)unzip the downloaded php-5.5.10-win32-vc11-x64.zip to the installation directory (D: \ phpEnv \ php)
(2) copy the php. ini-development file in the directory and change it to php. ini, which is the configuration file of php.
(3) add php support for the Apache service
Open the Apache configuration file http. conf and add
# Php5 support
LoadModule php5_module e:/php/php5apache2_4.dll
AddType application/x-httpd-php. php. html. htm
# Configure thepath to php. ini
PHPIniDir "e:/php"
Here I add it under LoadModule
Make sure that the php5apache2_4.dll file exists in the php5.5 earlier version, but the file is already available in the later version. you can open the php installation directory to find the file.
PHPIniDir "e:/php". This is your php root directory.
(4) restart the Apache server.
(5). test. Delete other files in www and create an index. php file. the content is <? Php phpinfo ();?> Save. accessing the php information indicates that php has been successfully installed.
Note:
Some common Php configuration changes: (e: \ php. ini)
Time zone settings: date. timezone = Asia/Shanghai
Error Report level: error_reporting = E_ALL, which can be enabled in development mode.