Apache + PHP installation and use

Recent exposure to a project, we need to use PHP, so if the computer needs to be installed in PHP environment, the following is the process continues to step on my mine, mine clearance.

1. Before installing PHP environment need to install Apache, and therefore need to download and install Apache.

Download Link: http://httpd.apache.org/download.cgi

 

 And click into the ApacheHaus, as shown below.

 Here, some blog will mention the difference between v11 and v14, and will be associated with PHP version. Here I also Baidu, and no related things for reference, it depends on intuition.

 

 When the download is complete, an archive, unzip it into after the specified location, where I put D: \ Program Files under the path.

 

2, httpd.conf file conf folder configuration Apache24 folder.

Note: In the httpd.conf file, # denotes a comment.

① change the port number to avoid conflict. 

Listen 8081

② the comment character statement (#) deleted as follows.

LoadModule access_compat_module modules/mod_access_compat.so

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule vhost_alias_module modules/mod_vhost_alias.so

③ add two php configuration statement

LoadModule php7_module "D:/Program Files/php/php7apache2_4.dll"
PHPIniDir "D:/Program Files/php"

④ modify the specified path SRVROOT.

Define SRVROOT "D:\Program Files\Apache24"

⑤ Other

<IfModule dir_module>
    DirectoryIndex index.html index.php 
</IfModule>

  AddType application/x-compress .Z
  AddType application/x-gzip .gz .tgz
  AddType application/x-httpd-php .php

Note: Red is part of the need to add.

Apache configuration will be basically completed, and here I did not modify the path which Apache has access, if need to modify the path, you can refer to other people's documents.

3, PHP downloads

Download Link: https://www.php.net/downloads.php

Once downloaded, unzip to the specified folder, where I put it in D: \ Program Files folder, changed its name to php.

4, PHP configuration

4.1 php.ini-development or php.ini-production file copy, rename it to php.ini.

4.2 php.ini configuration file (semicolon (;) is the Notes)

4.2.1 some extension uncommented, as follows:

extension=curl

extension=openssl

4.2.2 Configuration extension_dir path

extension_dir = "D:/Program Files/php/ext"

While the semicolon deleted.

5, test

5.1 Apache using the command line, start, restart, shut down the service.

          Install apache server: httpd.exe -k install

          Start Services apcache24 services: httpd -k star

          Stop service apcache24 services: httpd -k stop

          Restart the service apcache24 services: httpd -k restart

5.2 D: Creating phpinfo.php \ under Program Files \ Apache24 \ htdocs path

5.3 The following code is written in phpinfo.php.

<?php
    phpinfo();
?>

5.4 In the browser, enter: HTTP: // localhost: 8081 / phpinfo.php , showed the following page configuration is successful environment.

6, summed up

If there is anything missing or wrong place, also please correct!

Published 22 original articles · won praise 28 · views 50000 +

Guess you like

Origin blog.csdn.net/zfan520/article/details/101270076