Configure Apache to identify PHP

Source: Internet
Author: User

1. ConfigurationApache1)Modifyf:\server\apache\conf\httpd.conf

① Open with EditPlus f:\server\apache\conf\httpd.conf

② because the virtual domain name, the 179-194,206-234 Lines commented out (in front plus #):

③ adds index.php to line 241, allowing Apache to recognize the PHP home page

Switch

④ to support PHP, add the following lines at the end of the file ( Please select one of the CGI and module modes, typically in module mode ):

LoadModule php5_module "F:/server/php/php5apache2_2.dll"

Phpinidir "f:/server/php"

AddType application/x-httpd-php. php

⑤ Remove comments for 463 lines (you can configure multiple virtual sites in httpd-vhosts.conf):

Switch

⑥ Save httpd.conf. Then put this file into the project, convenient for later modification.

2)Modifyf:\server\Apache\conf\extra\httpd-vhosts.conf

① Open with EditPlus f:\server\apache\conf\extra\httpd-vhosts.conf

② to configure the virtual domain name, the 27-42 lines commented out (plus #) or delete;

③ Add the following: (with a space, all the PHP will only be thrown f:\www\ under the analysis)

<virtualhost *:80>

# Options None

ServerAdmin [email protected]

DocumentRoot F:\SERVER\WWW\LCC

ServerName lcc.com

Errorlog Logs/lcc.com-error_log

Customlog Logs/lcc.com-access_log Common

Php_admin_value Open_basedir "F:\server\www\lcc;c:\windows\temp"

</VirtualHost>

I set up two spaces to compare the differences between the two configurations.

I use db.com to access files under the F:\server\www\db folder, which is a Web site, and lcc.com access to the F:\SERVER\WWW\LCC folder is another site.

④ Save and restart Apache. If you can't start a popup box or a window below the command line for 12apache troubleshooting, you know what to do, huh?

Attention:

A, the above virtual host settings in the "Options None" line : Access to the directory without the default home page, the directory list is forbidden. If you do not have a default home page and want to list the files in the directory, delete this line.

B, lcc.com is my own test domain name, you can set your own test domain name according to the actual situation, such as lcc1.com.

C, after modifying httpd.conf or httpd-vhosts.conf, you must restart Apache.

D. Remove the comment from this line to start the URL rewrite function: (can be ignored first )

LoadModule Rewrite_module modules/mod_rewrite.so

E, if the site uses gb2312 encoding, edit the httpd.conf, this line of comments removed : (you can generally ignore this action)

Include conf/extra/httpd-languages.conf

Then edit httpd-languages.conf:

Add one line at the end : Adddefaultcharset gb2312

Thus, when using AJAX, the transmitted data is gb2312, do not have to use php iconv function between gb2312 and Utf-8 transcoding.

A、Apache Row Wrong

What's the problem?

Line 32 errorlog logs/ivy.com and -error_log cannot have spaces in the middle,

Line 33 customlog logs/ivy.com and -access_log can not have spaces between

-, configure domain names

Modify c:\windows\system32\drivers\etc\hosts to add such a line :

127.0.0.1 lcc.com

You can then browse http://lcc.com to access and debug the program.

Note: After you modify the Hosts file, be sure to reopen the browser (you cannot create a new window).

Because ie is cached, if you access http://lcc.com in the IE window that you opened before modifying the Hosts file, it is not pointing to the 127.0.0.1 IP.

Note:lcc.com is my own test domain, you can set your own test domain name according to the actual situation, such as lcc1.com.

Configure Apache to identify PHP

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.