PHP is short for HypertextPreprocessor. PHP is an embedded HTML language. it is a scripting language that executes HTML documents embedded on the server. it is widely used in a style similar to C language. PHP 7 has been out for some time. I have been busy working some days ago and have no time to study it. now I have a little time. I cannot upgrade the production environment of my company, you can install your own computer at home to check the effect.
The following describes how to install PHP 7 + Apache 2.4.
Install and configure Apache 2.4
Apache 2.4 does not have any compiled version in Windows on the official website. After the download, extract the Apace24 directory in the ZIP package to any directory.
Note: Some information about Apache and PHP must match, including the 32/64-bit and VC version numbers. For PHP 7, only the version compiled by VC14 is available on the official website. Therefore, the corresponding Apache version also needs to be compiled by VC14.
Configuration
Single site configuration
Open the % Apache24 % \ conf \ httpd. conf file:
1. find "ServerRoot" and specify it as the Directory of % Apache24 %;
2. modify the document root directory;
DocumentRoot "E:/wwwpages"
3. Add index. php to the index Directory.
DirectoryIndex index.html index. php
4. install Apache as a service:
Httpd.exe-k install-n "Apache24"
If the service fails to be started, modify the port number.
Multi-site configuration (differentiated by port number)
Multiple sites can be configured on one server. This section describes how to configure different sites differentiated by port numbers.
Configure httpd. conf.
First, add the listening port (add the following ports when configuring several sites ):
Listen 8081.
Listen 8082.
After the preceding settings, you can use netstat-n-a to check whether the port is enabled.
Configure the virtual site:
NameVirtualHost *:8080
ServerName www.mysite1.com #DocumentRoot "C:/Rainman/ProjectWorkspace2.0/SourceCode/Server/wanpush" DocumentRoot "C:/Rainman/ProjectWorkspace3.0_clound/SourceCode"
Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all
ErrorLog "logs/mysite1.com-error.log" CustomLog "logs/mysite1.com-access.log" common
NameVirtualHost *:8081
ServerName www.mysite2.com DocumentRoot "C:/Rainman/ProjectWorkspace3.0_clound/yiqixiu"
Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all
ErrorLog "logs/mysite2.com-error.log" CustomLog "logs/mysite2.com-access.log" common
Configure the DocumentRoot and Directory parameters for each virtual site.
Verify
After the installation is complete, compile the following HTML page:
Hello world!
Index.html. copy the file to "E:/wwwpages.
Open URL: http: // localhost: 8080/. the page displays "Hello world !", Indicates that Apache is successfully installed and started.
Uninstall service
Uninstall the service: httpd-k uninstall-n "apache24"
Note: The name must be consistent with the name used during installation.
Install and download php-7.0.6-win32-vc14-x64.zip in PHP 7.0.6 and decompress it to any directory.
Configuration 1. configure Apache
Open the Apache configuration file and add the following content:
LoadModule php7_module "D:/PHPDevEnv/PHP/php7apache2_4.dll"AddType application/x-httpd-php .phpAddType application/x-httpd-php .htmlAddHandler application/x-httpd-php .phpPHPIniDir "D:/PHPDevEnv/PHP"
Note: The actual path is used for the red part.
2. configure PHP
Rename PHP. ini-development under the php directory to php. ini, open the file, search for "extension_dir", remove the preceding comment, and change it to an absolute path. for example:
Extension_dir = "D:/PHPDevEnv/PHP/ext"
Note: changing to an absolute path prevents some PHP extensions from finding the correct path.
Verify that a phpinfo. php file is created under the Apache website root directory (for details, see section 2.1:
<? Php
Phpinfo ();
?>
Open http: // localhost: 8080/phpinfo. php.