Php7 + apache2 construction in window, php7apache2

Source: Internet
Author: User
Tags php website

Php7 + apache2 construction in window, php7apache2

1. Download php7 and apache2.4

First download php7 windows compressed package, download http://windows.php.net/download/ here

Php7 VC14 x86 Thread Safe (21:09:17) zip [20.98 MB]

In Windows, thread security is generally used. Note that the php version is compiled by vc14, which means that the environment can run normally only when vc2015 (vc14) is installed.

 

Decompress the PHP 7 windows package and Apache2.4, as shown in my path:

D: \ web \ Apache \

D: \ web \ php7 \

D: \ web \ www \ (directory for storing php website scripts, DocumentRoot .) note: If the default website Script directory of Apache is changed, there will be access permission issues. This is the default mechanism of Apache.

2. Configure httpd. conf and php. ini:

1. Open Apache/conf/httpd. conf

Modify: ServerRoot "D:/web/Apache"

Modify: DocumentRoot "D:/web/www /"

Add: (Note that the phpIniDir item is on top) php7's apache processing interface

PHPIniDir "D:/web/php7 /"

LoadModule php7_module "D:/web/php7/php7apache2_4.dll"

(Specify the dll connecting php and apache)

Add: php minetype:

<IfModule mime_module>

TypesConfig conf/mime. types

AddType application/x-httpd-php. php

</IfModule>

2. Configure php. ini. Open the php Directory, copy one php. ini-development, and change it to php. ini.

Open php. ini, find; extension_dir = "D:/web/php7/ext", and remove the semicolon.

(The extension path must be specified. Otherwise, PHP 7 cannot be started. After the ext extension directory is enabled, you can successfully start php7 on the command line. If it still fails, it indicates that your php path is not added to the environment variable (or your environment variable is used by the old php version ))

3. You need to check the default website Script directory of Apache. skip this step if no.

Open httpd. conf and find

<Directory/>
AllowOverride All
Require all denied
</Directory>

Change to the following:

<Directory />

     Options FollowSymLinks      AllowOverride all      Order deny,allow      Allow from all </Directory>4. Start

Run the cmd command line as an administrator, enter the D disk, open the directory, and run httpd-k install

D:

Cd D: \ web \ Apache \

Httpd-k install

Httpd-k start

 

In this way, apache and php7 are started.

Create a phpinfo. php file in D:/web/www /.

Note: If you have enabled the Include conf/extra/httpd-vhosts.conf Vm, You need to configure the VM in Apache/conf/extra/httpd-vhosts.conf for normal access

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.