PHP Mobile Internet Development (1)--environment setup and configuration

Source: Internet
Author: User
Tags apache download log mysql mysql download net php download access root directory

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

  1. ServerRoot "D:/apache Software Foundation"

Listening port

  1. #Listen 12.34.56.78:80
  1. Listen 80

Load PHP Components

    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
    1. <directory "D:/apache Software Foundation/htdocs" >

Index (Default access Home page)
    1. <ifmodule dir_module>
    2. DirectoryIndex index.html
    3. </IfModule>
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

Type of error
    1. #ErrorDocument "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_

Four, test whether build success

New a.php

  1. <?php
  2. Phpinfo ();
  3. ?>

You can see that the configuration file for PHP is not found, we specify the PHP configuration file directory in the Apache configuration file

  1. Phpinidir "D:/PHP54"


V. Configuring multiple Site Access

    1. # Virtual Hosts
    2. 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

  1. <virtualhost *:80>
  2. DocumentRoot "D:/apache Software foundation/a_com"
  3. ServerName 127.0.0.2
  4. Serveralias www.dummy-host.meritit.com
  5. ErrorLog "Logs/dummy-host.meritit.com-error.log"
  6. Customlog "Logs/dummy-host.meritit.com-access.log" common
  7. </VirtualHost>
  8. <virtualhost *:80>
  9. DocumentRoot "D:/apache Software foundation/b_com"
  10. ServerName 127.0.0.3
  11. ErrorLog "Logs/dummy-host2.meritit.com-error.log"
  12. Customlog "Logs/dummy-host2.meritit.com-access.log" common
  13. </VirtualHost>

Note: Once the virtual host is configured, the previously configured DocumentRoot is invalid.

D:\Apache Software foundation\a_com\a.php

    1. <?php
    2. echo "AAAAAA";
    3. ?>
D:\Apache Software foundation\b_com\b.php
    1. <?php
    2. echo "BBBBBB";
    3. ?>

Note: To modify the Permissions folder directory

Access results:




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.