Home >Backend Development >PHP Tutorial >PHP 7 installation and configuration in win10 environment [Tutorial]_php skills

PHP 7 installation and configuration in win10 environment [Tutorial]_php skills

WBOY
WBOYOriginal
2016-05-16 09:00:161554browse

php 7 has been out for a while. i was busy with work a few days ago and didn’t have time to study it. now i have some time. the production environment in the company cannot be upgraded casually. you can still install it on your own computer at home and see the effect.

the following is a brief explanation of the installation of php 7 apache 2.4.

apache 2.4 installation configuration installation

apache 2.4, there is no compiled version for windows on the official website. you need to go to http://httpd.apache.org/docs/2.4/platform/windows.html to find the mirror website that provides downloading of the windows compiled version. i use the link is: http://www.apachelounge.com/download/. download the 32- or 64-bit version as needed. after downloading, it is a zip package. after downloading, unzip the apace24 directory in the zip package to any directory.

note: some information of apache and php must match, including 32/64-bit and vc version numbers. for php 7, there is only a version compiled with vc14 on the official website, so the corresponding apache version also needs to be compiled with vc14.

configuration

single site configuration

open the %apache24%\conf\httpd.conf file:

1. find "serverroot" and specify it as the directory where %apache24% is located;

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. install apache as a service:

httpd.exe -k install -n "apache24"

if the service fails to start, modify the port number.

multi-site configuration (differentiated by port number)

multiple sites can be configured on one server. this section explains how to configure different sites distinguished by port numbers.

configure httpd.conf.

first add the listening port (configure several sites, add a few ports):

listen 8081

listen 8082

after the above contents are set, you can check whether the port is open through netstat -n -a.

secondly configure the virtual site:


namevirtualhost *:8080 

<virtualhost *:8080> 

 servername www.mysite1.com 

 #documentroot "c:/rainman/projectworkspace2.0/sourcecode/server/wanpush" 

documentroot "c:/rainman/projectworkspace3.0_clound/sourcecode" 

 <directory "c:/rainman/projectworkspace3.0_clound/sourcecode"> 

options indexes followsymlinks 

allowoverride none 

order allow,deny 

allow from all 

 </directory> 

errorlog "logs/mysite1.com-error.log" 

 customlog "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 from all 

 </directory> 

errorlog "logs/mysite2.com-error.log" 

 customlog "logs/mysite2.com-access.log" common 

</virtualhost> 

mainly configure documentroot and directory parameters for each virtual site.

verification

after the installation is complete, write the following html page:

<html>
<body>
<h1>hello world!</h1>
</body>
</html>


save it as index.html and copy the file to "e:/wwwpages".
open the url: http://localhost:8080/, and the page displays "hello world!", which means that the apache installation is started successfully.

uninstall a service

uninstall the service: httpd –k uninstall –n “apache24”

note: the name must be consistent with the name during installation.

php 7.0.6 installation configuration installation download php-7.0.6-win32-vc14-x64.zip and extract 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 .php
AddType application/x-httpd-php .html
AddHandler application/x-httpd-php .php
PHPIniDir "D:/PHPDevEnv/PHP"



note: the red part uses the actual path.

2. configure php

rename php.ini-development in the php directory to php.ini, then open the file and search for "extension_dir", remove the previous comment and change it to an absolute path, for example:
extension_dir = "d:/phpdevenv/php/ext"

note: changing the path to an absolute path is to prevent some php extensions from not finding the correct path.
verification create a phpinfo.php file in the root directory of the apache website (see section 2.1 for the specific location):
phpinfo();
?>

open http://localhost:8080/phpinfo.php.

in your browser
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn