Home  >  Article  >  Backend Development  >  apache php setting method

apache php setting method

藏色散人
藏色散人Original
2020-09-01 09:56:135157browse

apache php setting method: first download and decompress Apache24 to any disk location; then modify the default port and server name; then download and decompress PHP7 to any disk location; finally configure "php.ini" and test it Can.

apache php setting method

Recommended: "PHP Video Tutorial"

Apache2.4

https:// pan.baidu.com/s/1hkqUX9IJXsGF2-hSvLVy4A gjpr

php7

https://pan.baidu.com/s/1rqxAaHuKyIYkzrIHEsQ8AQ wo58

1. Download and unzip Apache24 to any disk location, here is the D drive, and rename it to Apache2.4.

2. Open the path Apache2.4→conf→httpd.conf.

3. Modify Define SRVROOT ":/Apache2.4" to the Apache2.4 file path, here is Define SRVROOT "D:/Apache2.4".

4. Modify the default port Listen 80 to an unused port number, here it is Listen 88.

5. Modify the server name ServerName localhost:80 is the port number set above, here is ServerName localhost:88.

At this point Apache can be used normally, but PHP has not been contacted.

6. Test it

1) Open ApacheMonitor.exe to start the server

2)Open localhost:88## in the browser

#7. Download and unzip PHP7 to any disk location, here is the D drive, and rename it to php.

8. Configure php.ini

First, rename

php.ini-production in the php installation directory to php.ini

Open php.ini and make the following modifications:

1) Set the extension path of php

Find

;extension_dir = "./ ", add

extension_dir = "ext"

##extension=php_mbstring.dll

extension=php_mysql.dll

extension=php_mysqli.dll

2) Find

;date.timezone = Set to date.timezone = Asia/Shanghai Go to this php.Ini Configuration completed

9.Apache is associated with php7

1) Open httpd.conf and find

#LoadModule xml2enc_module modules/mod_xml2enc.so part, and append the following code at the end:

LoadModule php7_module D:/wangshuyi/php7/php7apache2_4.dll

2) Find the part of

#AddEncoding x-gzip .gz .tgz, and append the following current code at the end:

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

3) Specify the php.ini configuration file path

Specify the directory of the PHP configuration file php.ini in the httpd.conf file. Here, locate the end of the httpd.conf file and add the following line at the end of the text. Code:

PHPIniDir "D:/ php"

("D:/ php" here is the actual path where your php.ini file is stored) 4) Configure DirectoryIndex

to search for "

DirectoryIndex" part, append a "index.php index.htm"

after DirectoryIndex

5) Remove the comments (#) from the following two lines of code

#LoadModule rewrite_module modules/mod_rewrite.so

# LoadModule vhost_alias_module modules/mod_vhost_alias.so

Now all configurations are completed

10.

Test

1) Create a new index.php in your apache site directory (of course it can be another name), open it with a text editor (such as Notepad), add the following code in it, and save

<?php
phpinfo();
?>

2) The browser opens http://localhost:88/index.php

The configuration is successful as shown below

The above is the detailed content of apache php setting method. For more information, please follow other related articles on the PHP Chinese website!

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