PHP 7 came out for a long time, the previous days work more busy, no time to study, now a little time, the company's production environment can not casually upgrade, the home of their own computer can be installed to see the effect.
Here's a brief description of the installation of PHP 7 + Apache 2.4.
Apache 2.4 Installation Configuration Installation
Apache 2.4, the official website does not have a compiled version of Windows, need to http://httpd.apache.org/docs/2.4/platform/ windows.html Find a mirrored web site that provides downloads for Windows compiled versions, I used: http://www.apachelounge.com/download/, download 32 or 64-bit versions as needed, and download a zip package. After downloading, unzip the Apace24 directory in the ZIP package to any directory.
Note: Apache and PHP have some information to match, including 32/64 bit, VC version number. For PHP 7, the official web only VC14 compiled version, so the corresponding Apache version also need to be VC14 compiled.
Configuration
Single Site Configuration
Open%apache24%\conf\httpd.conf File:
1, find "ServerRoot", designated as the directory of%apache24%;
2, modify the document root directory;
DocumentRoot "E:/wwwpages"
<directory "E:/wwwpages" >
3, add index.php to the index directory
DirectoryIndex index.html index.php
4, the Apache installed into service:
Httpd.exe-k install-n "Apache24"
Modify the lower number if the service fails to start.
Multi-site configuration (differentiated by port number)
Multiple sites can be configured on a single server, and this section explains how to configure different sites that are differentiated by port numbers.
Configure Httpd.conf.
First increase the listening port (configure several sites, add several ports):
Listen 8081
Listen 8082
After the above content is set, you can see if the port is open by Netstat-n-A.
Second, configure the virtual site:
Namevirtualhost *:8080 <virtualhost *:8080> ServerName www.mysite1.com #DocumentRoo T "C:/rainman/projectworkspace2.0/sourcecode/server/wanpush" DocumentRoot "c:/rainman/projectworkspace3.0_clound/ SourceCode "<directory" C:/rainman/projectworkspace3.0_clound/sourcecode "> Options Indexes followsymlinks All Owoverride None order Allow,deny allow from all </Directory> ErrorLog "Logs/mysite1.com-error.log" custo
Mlog "Logs/mysite1.com-access.log" common </VirtualHost> namevirtualhost *:8081 <virtualhost *:8081> ServerName www.mysite2.com documentroot "C:/rainman/projectworkspace3.0_clound/yiqixiu" <directory "c:/rainman/" Projectworkspace3.0_clound/yiqixiu "> Options Indexes followsymlinks allowoverride None order Allow,deny allow F
Rom all </Directory> ErrorLog "Logs/mysite2.com-error.log" Customlog "Logs/mysite2.com-access.log" common </VirtualHost>
Configure DocumentRoot and directory parameters primarily for each virtual site.
Verify
After the installation is complete, write the following HTML page:
Save As Index.html, the file is copied to "E:/wwwpages".
Open url:http://localhost:8080/, and the page displays "Hello world!", which means that the Apache installation started successfully.
Uninstall Service
Uninstall Service: Httpd–k uninstall–n "Apache24"
Note: The name must be consistent with the name of the installation.
The PHP 7.0.6 installation configuration installs the download Php-7.0.6-win32-vc14-x64.zip, extracts it to any directory.
Configuration 1, configuring Apache
Open the Apache configuration file and add the following:
LoadModule php7_module "D:/phpdevenv/php/php7apache2_4.dll"
addtype application/x-httpd-php. PHP
AddType application/x-httpd-php. html
AddHandler application/x-httpd-php. php
phpinidir "d:/phpdevenv/php"
Note: The red section uses the actual path.
2. Configure PHP
Rename the php.ini-development in the PHP directory to PHP.ini, then open the file, look for "extension_dir", remove the previous comment, and modify it to an absolute path, for example:
Extension_dir = "D:/phpdevenv/php/ext"
Note: Modifying to absolute path is to avoid some PHP extensions not finding the correct path.
Verify that a phpinfo.php file is created under the Apache site root directory (see section 2.1):
<?php
Phpinfo ();
?>
Open the http://localhost:8080/phpinfo.php in the browser.