1: Preparation stage
1:php
php-5.5.13 download link: http://windows.php.net/downloads/releases/php-5.5.13-Win32-VC11-x64.zip
Recommend Thread Safe V11 x64, which is 64bit.
Nowadays, the PHP installation packages downloaded from the PHP official website have the words VC11 or VC9. What does this mean? Which installation package should we download better?
In fact, the PHP official website gives 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 2012 x86 or x64 installed.
VC9 means that this version of PHP is compiled with Visual Studio 2008, while VC11 is compiled with Visual Studio 2012. This means
If you download the VC9 version, you need to install Visual C++ Redistributable for Visual Studio 2008 SP1 first,
If you download the VC11 version, you need to install VisualC++RedistributableforVisualStudio2012.
V11 is a component of Microsoft. If it is not installed, it will prompt that msvcr110.dll is missing.
Download link: http://www.microsoft.com/zh-CN/download/details.aspx?id=30679
Please download the 64bit version. After the installation is complete, please restart your computer
2: apache2.4.9, download link: http://www.apachelounge.com/download/
V11, 64-bit is also recommended.
3: mysql 5.6.19, download link: http://dev.mysql.com/downloads/mysql/
It is also recommended mysql-5.6.19-winx64.zip
Two: Method/Steps
1: Install and configure Apache2.4.9 (httpd-2.4.9-win64-VC11.zip)
Unzip the downloaded installation package: httpd-2.4.9-win64-VC11.zip and put it in your own installation directory (my directory E: Apache24)
Then modify the http.conf (E:Apache24confhttp.conf) configuration file - just open it with Notepad
(1) Modify the root path of ServerRoot Apache:
(line 37) Change ServerRoot "c:/Apache24" to => ServerRoot "E:/Apache24"
(2) Modify ServerName to your host name:
(Line 217) ServerNamewww.example.com:80 Remove the # in front. This attribute is needed when starting Apache from the command line.
(3) Modify the main folder directory accessed by DocumentRoot Apache, which is the location of the php and html code files. The default path of Apache is under htdocs (E:Apache24htdocs), which has a simple entry file index.html. This path can be modified by yourself. I configure it here under my own newly created folder www (E: phpwww).
(Line 247) DocumentRoot "c:/Apache24/htdocs"
Change to=>
DocumentRoot "E:phpwww"
(4) Modify the entry file configuration: DirectoryIndex. Generally, we use index.php, index.html, and index.htm as the entry points for web projects. Apache's default entry is only index.html, and you need to add support for the other two. Of course, the settings of this entry file can be increased or decreased according to your own needs. If the requirements are stricter, you can only write one index.php, so that the entry in the project is It can only be index.php
(Line 274)
DirectoryIndexindex.html
Change to =>
DirectoryIndex index.php index.htm index.html
(5) Set the serverscript directory:
(Line 358) ScriptAlias/cgi-bin/ "c:/Apache24/cgi-bin/" changed to => ScriptAlias/cgi-bin/ "e:/Apache24/cgi-bin"
(6)(line 374)
AllowOverride None
Options None
Require all granted
changed to =>
AllowOverride None
Options None
Require all granted
Next you can start Apache
Start---Run, enter cmd, open the command prompt. Then enter the e:Apache24bin directory and press enter httpd press enter,
If no error is reported, you can test it (keep the command window open).
Put the index.html in the Apache24htdocs directory into the e:phpwww directory. If you access it with a browser, "It works" will appear, which means that apache has been correctly installed and started. You can also write a simple index.html file yourself and open it.
Note: Apache uses port 80 by default. If port 80 is occupied, Apache will not be able to start. At this time, you can change the Apache port to solve this problem.
Change the port: Find the httpd.conf file in the conf directory under the Apache installation directory (i.e. e:Apache24confhttpd.conf). Open it. Find "Listen80", the number immediately following Listen is the port number, we change it to "Listen 8080". You can also change it to another unused port number. . Restart Apache for the new configuration to take effect. You can start apache using "Apache Serive Monitor" in the status bar in the lower right corner. You can also click "Start" > "Run" > enter cmd > Enter > Navigate to the apache installation directory to the bin directory, and then enter "httpd –k start".
Add Apache to the window service startup item and set it to start at boot
Close the httpd service first (just close the command window)
Re-open a new command window and enter the E:Apache24bin directory:
The command to add HTTP service is: httpd.exe -kinstall -n "servicename" servicename is the name of the service. What I added is: httpd.exe -k install -n "Apache24" There will be a success prompt after the command is successful. , at this time you can see the Apache24 service in the window service startup item
Or (e:apache24binhttpd.exe -k install)
If you appear at this time: Installing the Apache2.4 service (OS 5) access denied. : AH00369: Failed to open the WinNT service manager, perhaps you forgot to log in as Adminstrator? This error is because when installing Apache, the download is in zip format, not the msi installation version. You need to register the service yourself before you can install it. There is an httpd icon in the desktop taskbar. As a result, an error occurred when entering the installation service command in the cmd command line. The above error occurred. The error message prompted me that I was not logged in as an administrator!
Solution: Run cmd as administrator, and then re-enter the command. After successful execution, the Apache24 service can be found in the system services.
Then click Start. If you don’t want to set it to startup, you can also change the startup type to manual.
If you want to uninstall this service, you must first stop the service, and then enter httpd.exe -k uninstall -n "Apache24" to uninstall the service.
Of course, you can also start Apache through ApacheMonitor.exe under E:Apache24bin. I won’t go into details here
In this way, the configuration of Apache is basically completed.
2: Install and configure php5.5.13 (php-5.5.13-Win32-VC11-x64.zip)
(1) Extract the downloaded php-5.5.10-Win32-VC11-x64.zip to the installation directory (D:phpEnvphp)
(2) Copy the php.ini-development file in the directory and rename it to php.ini. It is the configuration file of php
(3) Add php support for Apache service
Open Apache’s configuration file http.conf and add
at the end# 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"
I added it under LoadModule
When adding, make sure that your php5apache2_4.dll file does exist. There is no such file in the early version of php5.5, but it is already in the higher version. You can open the php installation directory and find this file
PHPIniDir "e:/php" This is your php root directory
(4). Restart the Apache server.
(5). Test. Delete other files in www, create a new index.php with the content of Save it. When accessing the php information, it means that php has been successfully installed.
Remarks:
Some common configuration modifications for Php: (e:phpphp.ini)
Time zone setting: date.timezone = Asia/Shanghai
Error reporting level: error_reporting = E_ALL can be turned on in development mode.
Building a php development environment
1. Set up under windows
Windows+php+mysql+phpmyadmin =>wamp
In linux
Linux+apache+mysql+php =>lamp
2. Suite installation
Appserver Thai apache+mysql+php+phpmyadmin
Custom installation: You can choose the version of each software according to development needs; apache+mysql+php+phpmyadmin
Installed in the same folder for easy management (do not include Chinese characters in the folder), install one and test one
①Install apache
After completion, localhost
②Install the php core package (apache---->VC6 version IIS---->VC9 version), unzip it
③Integrate apache and php
A. Add the following code to apache/conf/httpd.conf
# Let apache load the php processing module
LoadModule php5_module php installation directory/php5apache2_2.dll
#Specify the ini file of php, which is some configuration of php
PHPIniDir ''php installation directory"
AddType application/x-httpd- php .php .phtml
B. Change the php.ini-development file under php to php.ini because the php settings need to be modified in php.ini
C. Specify the corresponding function module in php.ini
;Specify the PHP extension library path here
Extension_dir="php installation path/ext"
session.save_path = Remove the front;
And set the path "php installation path/session_temp" and put it in the Create a new folder session_temp under the path
D. Test
Write text.php under apache/htdocs
localhost/text.php
④Install mysql
A. Write a piece of code to test whether it is successful
$conn=mysql_connect("localhost","root","root");
If($conn){
Echo" successfully connected to the database! ";
}else{
Echo" Failed to connect to the database! ";
}
?>
Enable mysql function in php.ini
Extension=php_mysql.dll
Extension=php_mysqli.dll
B. Install a phpmyadmin Let’s see if we can use
to unzip phpmyadmin to apache/htdocs
and access localhost/phpmyadmin/index.php... The rest of the text>>
It is very troublesome to configure these three things separately. It is recommended that the author use wampServer. This is an integrated development environment. After installation, it will come with Apache+MySQL+PHP, and it does not require you to perform any configuration. It can be used immediately after installation. Simple + practical! Highly recommended!
Search on Baidu and download!