First, PHP5.4 environment collocation basic flow
Apache:web service provider. Official website: www.apache.org
PHP: Official website: www.php.net
Mysql: Official website: www.mysql.com
Second, 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
Third, the environment constructs
(1) Apache Installation
Installation Successful
(2) Decompression PHP5.4
(3) Configure Apache httpd.conf files
Apache installation directory
- ServerRoot "D:/apache Software Foundation"
Listening port
- #Listen 12.34.56.78:80
- Listen 80
Load PHP Components
- LoadModule php5_module "D:/php54/php5apache2_2.dll"
Server name
- #ServerName www.meritit.com:80
File root directory
- DocumentRoot "D:/apache Software foundation/htdocs"
Permissions folder
- <directory "D:/apache Software Foundation/htdocs" >
Index (Default access Home page)
- <ifmodule dir_module>
- DirectoryIndex index.html
- </IfModule>
Error log
- 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
Type of error
- #ErrorDocument "The server made a boo boo."
- #ErrorDocument 404/missing.html
- #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
- #ErrorDocument 402 Http://www.meritit.com/subscription_
Four, test whether build success
New a.php
- <?php
- Phpinfo ();
- ?>
You can see that the configuration file for PHP is not found, we specify the PHP configuration file directory in the Apache configuration file
- Phpinidir "D:/PHP54"
V. Configuring multiple Site Access
- # Virtual Hosts
- Include conf/extra/httpd-vhosts.conf
Remove the comment above (open the virtual host configuration file)
Two sites are configured in httpd-vhosts.conf as follows
- <virtualhost *:80>
- 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
- </VirtualHost>
- <virtualhost *:80>
- 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
- </VirtualHost>
Note: Once the virtual host is configured, the previously configured DocumentRoot is invalid.
D:\Apache Software foundation\a_com\a.php
- <?php
- echo "AAAAAA";
- ?>
D:\Apache Software foundation\b_com\b.php
- <?php
- echo "BBBBBB";
- ?>
Note: To modify the Permissions folder directory
Access results: