How to solve apache failure to configure php and VM

Source: Internet
Author: User
Tags php and

Xampp is used directly as an apache server, but the new version of xampp also jumps to the virtual host when it is added to 127.0.0.1. For example, I added www.demo.com with the path e: wwwdemo, after I added it, I even ran to www.demo.com to access 127.0.0.1.

I found a lot of information on the Internet to add localhost, so I added the following configuration at the end of httpd. conf:

The code is as follows: Copy code

<VirtualHost *>
DocumentRoot E: www
ServerName 127.0.0.1
# ErrorLog logs/default-error_log
</VirtualHost>
 
<Directory "E: www">
Options Indexes FollowSymLinks Multiviews
AllowOverride All
Order Allow, Deny
Allow from all
</Directory>

I found that I still couldn't find it. During this period, PHPnow was installed, which was similar. Later I accidentally saw the NameVirtualHost configuration and wrote it:

NameVirtualHost * restart apache!

Procedure


Next let's modify the httpd. conf file.

The httpd. conf file is an important configuration file for Apache work. Find it in X: Apache GroupApache2conf and open it with notepad. You can modify it as follows:

The code is as follows: Copy code

ServerRoot "X:/Apache Group/Apache2"

This is the root path of the server and does not need to be changed.

The code is as follows: Copy code

MaxKeepAliveRequests 100

The maximum number of online users depends on the number of users you need and the configuration of your server.

The code is as follows: Copy code

Listen 80

The listening port of Apache2, which is usually the http port of the website.

The code is as follows: Copy code

DocumentRoot "C:/htroot"

This is where you place the webpage file. The compiled PHP file is placed here. Make sure that this folder exists, which is your site directory.

Same as above. Follow the previous step to make sure the folder exists.

The code is as follows: Copy code

DirectoryIndex index.htm index. php index.html

This is the document type of the home page opened by the server by default. It can be changed to the above type, with an empty lattice in the middle.

The code is as follows: Copy code

LanguagePriority zh-CN zh-TW en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt-BR ru sv

Language priority. Cut the part of Chinese (zh-CN zh-TW) to the front (that is, change the corresponding part of the original file to the above)

In addition, if you want to disable homepage browsing, find the following code:

The code is as follows: Copy code

Options Indexes FollowSymLinks

Remove the indexes and change it:

The code is as follows: Copy code

Options FollowSymLinks

Step 3: Mount PHP

Search for LoadModule in httpd. conf and add the following content later.

The code is as follows: Copy code

LoadModule php5_module "X:/PHP/php5Apache2. dll"

AddType application/x-httpd-php. php

Note: X: PHP/PHP5Apache2. dll indicates the path for installing PHP.

Restart Apache to make the modification take effect

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.