Home  >  Article  >  Backend Development  >  PHP Mobile Internet Development (1) - Environment Setup and Configuration_PHP Tutorial

PHP Mobile Internet Development (1) - Environment Setup and Configuration_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:35:09959browse

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

  1. ServerRoot "D:/Apache Software Foundation"

Listening port

  1. #Listen 12.34.56.78:80

  1. Listen 80

Load PHP component

  1. LoadModule php5_module "D:/php54/php5apache2_2.dll"
Server name

  1. #ServerName www.meritit.com:80
file root directory

  1. DocumentRoot "D:/Apache Software Foundation/htdocs"
Permissions folder


Index (default visits home page)

  1. DirectoryIndex index.html
error log

  1. ErrorLog "logs/error.log"

access log

  1. CustomLog "logs/access.log" common

Configure parsing php

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

error type

  1. #ErrorDocument 500 "The server made a boo boo."
  2. #ErrorDocument 404 /missing.html
  3. #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
  4. #ErrorDocument 402 http://www.meritit.com/subscription_

4. Test whether the construction is successful

Create a.php

  1. phpinfo();
  2. ?>

You can see that the php configuration file cannot be found. We specify the php configuration file directory in the apache configuration file

  1. PHPIniDir "D:/php54"


5. Configure multi-site access

  1. #Virtual hosts
  2. Include conf/extra/httpd-vhosts.conf
Remove the above comment (open the virtual host configuration file)

Configure two sites in httpd-vhosts.conf as follows

  1. DocumentRoot "D:/Apache Software Foundation/a_com"
  2. ServerName 127.0.0.2
  3. ServerAlias ​​www.dummy-host.meritit.com
  4. ErrorLog "logs/dummy-host.meritit.com-error.log"
  5. CustomLog "logs/dummy-host.meritit.com-access.log" common
  6. DocumentRoot "D:/Apache Software Foundation/b_com"
  7. ServerName 127.0.0.3
  8. ErrorLog "logs/dummy-host2.meritit.com-error.log"
  9. 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

  1. echo "aaaaaa";
  2. ?>
D:Apache Software Foundationb_comb.php
  1. echo "bbbbbb";
  2. ?>

Note: You need to modify the permission folder directory

Visit results:


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/746363.htmlTechArticle1. 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:...
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