Green Apache + PHP environment construction

Source: Internet
Author: User
: This article describes how to build a green Apache + PHP environment. For more information about PHP tutorials, see. Apache

1. httpd.exe-k install


D: \ DevelopPlatform \ Apache24X86 \ bin> httpd.exe-k install
Installing the 'apache2.4' service
The 'apache2.4' service is successfully installed.
Testing httpd. conf ....
Errors reported here must be corrected before the service can be started.
Httpd.exe: Syntax error on line 37 of D:/DevelopPlatform/Apache24X86/conf/httpd.
Conf: ServerRoot must be a valid directory
Corrected error:
Go to httpd. conf and set ServerRoot: (apache installation directory)
Example: ServerRoot "D:/DevelopPlatform/Apache24X86"

1.1. httpd.exe-k uninstall

Removing the 'apache2.4' service
The 'apache2.4' service has been removed successfully.

2. httpd.exe-k install

Installing the 'apache2.4' service
The 'apache2.4' service is successfully installed.
Testing httpd. conf ....
Errors reported here must be corrected before the service can be started.
AH00526: Syntax error on line 244 of D:/DevelopPlatform/Apache24X86/conf/httpd. c
Onf:
DocumentRoot must be a directory
Corrected error:
Go to httpd. conf, DocumentRoot :( apache htdocs directory)
Example: DocumentRoot "D: \ DevelopPlatform \ Apache24X86 \ htdocs"

2.1. httpd.exe-k uninstall

Removing the 'apache2.4' service
The 'apache2.4' service has been removed successfully.

3. httpd.exe-k install

Installing the 'apache2.4' service
The 'apache2.4' service is successfully installed.
Testing httpd. conf ....
Errors reported here must be corrected before the service can be started.

4.

So far, apache has been installed,
Configure apache
Go to httpd. conf
Find
Change Listen 80 to 8080 (change listening port to 8080 to prevent port 80 from being occupied)
Enable ServerName
Change to ServerName localhost: 8080
Restart apache and enter localhost: 8080/index.html in the browser for access.
An error may occur. the webpage outputs the following content:
You don't have permission to access/index.html on this server.
My solution is to enter httpd. conf
Under DocumentRoot "D: \ DevelopPlatform \ Apache24X86 \ htdocs ",
Find And change it:
In this case, restart the server and enter localhost: 8080/index.html again to access the server. the webpage will output the following content if no exception occurs:
It works!
Here, apache is officially installed!

5. add PHP support

First, go to httpd. conf.
1) add the following modules in the format:
LoadModule php5_module (full path of php5apache2_4.dll)
PHPIniDir (php installation directory)
Example:
LoadModule php5_module D:/DevelopPlatform/php/php5.6.5X86/php5apache2_4.dll
PHPIniDir D:/DevelopPlatform/php/php5.6.5X86
2) add PHP support
AddType application/x-httpd-php. php
Apache configuration complete

Php configuration

Go to the php installation directory:
Find php. ini-developer or php. ini-production.
Backup, and then remove the following-xxxx --> php. ini
Open php. ini
Locate; change extension_dir to extension_dir = "ext directory path under php"
Example: extension_dir = "D:/DevelopPlatform/php/php5.6.5X86/ext"
If you want to use My SQL, add the following statement:

Extension = php_mysql.dll

Restart the apache server!


Now the apache + PHP environment has been built;

The above describes how to build a green version of Apache + PHP environment, including some content, and hope to be helpful to friends who are interested in PHP tutorials.

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.