1. Basic process of PHP5.4 environment matching
Apache: Web service provider. Official website: www.apache.org
PHP: Official website: www.php.net
Mysql: Official website: www.mysql.com
2. Software download
Apache download address: http://download.csdn.net/detail/lxq_xsyu/7057423
PHP download address: http://download.csdn.net/detail/lxq_xsyu/7057401
Mysql download address: http://download.csdn.net/detail/lxq_xsyu/6468461
3. Environment setup
(1) Apache installation
Installation successful
(2) Unzip PHP5.4
(3) Configure Apache’s httpd.conf file
Apache installation directory
- ServerRoot "D:/Apache Software Foundation"
Listening port
- #Listen 12.34.56.78:80
- Listen 80
4. Test whether the construction is successfulLoad PHP component
Server name
- LoadModule php5_module "D:/php54/php5apache2_2.dll"
file root directory
- #ServerName www.meritit.com:80
Permissions folder
- DocumentRoot "D:/Apache Software Foundation/htdocs"
Index (default visits home page)
error log
- DirectoryIndex index.html
- ErrorLog "logs/error.log"
access log
- CustomLog "logs/access.log" common
Configure parsing php
- AddType application/x-compress .Z
- AddType application/x-gzip .gz .tgz
- AddType application/x-httpd-php .php
error type
- #ErrorDocument 500 "The server made a boo boo."
- #ErrorDocument 404 /missing.html
- #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
- #ErrorDocument 402 http://www.meritit.com/subscription_
Create a.php
- phpinfo();
- ?>
You can see that the php configuration file cannot be found. We specify the php configuration file directory in the apache configuration file
- PHPIniDir "D:/php54"
5. Configure multi-site access
Remove the above comment (open the virtual host configuration file)
- #Virtual hosts
- Include conf/extra/httpd-vhosts.conf
Configure two sites in httpd-vhosts.conf as follows
- DocumentRoot "D:/Apache Software Foundation/a_com"
- ServerName 127.0.0.2
- ServerAlias www.dummy-host.meritit.com
- ErrorLog "logs/dummy-host.meritit.com-error.log"
- CustomLog "logs/dummy-host.meritit.com-access.log" common
- DocumentRoot "D:/Apache Software Foundation/b_com"
- ServerName 127.0.0.3
- ErrorLog "logs/dummy-host2.meritit.com-error.log"
- CustomLog "logs/dummy-host2.meritit.com-access.log" common
Note: Once a virtual host is configured, the DocumentRoot configured previously will be invalid.
D:Apache Software Foundationa_coma.php
D:Apache Software Foundationb_comb.php
- echo "aaaaaa";
- ?>
- echo "bbbbbb";
- ?>
Note: You need to modify the permission folder directory
Visit results: