Use Wampserver to build a local PHP environment, bind domain names, configure pseudo-static

Source: Internet
Author: User
Tags php and mysql

Before the introduction of the Usbwebserver quickly set up a local PHP environment, recommended Usbwebserver reason is that it is green, do not need to install, want to use the manual can be run. But Usbwebserver also has its own weaknesses: not allowed to modify the configuration file, resulting in the inability to bind the domain name, as long as the detection of the file has been modified, will prompt an error, and because it is green, you may encounter can not be installed to enable some WordPress plugin. Therefore, the initiative has to choose other tools, contrast repeatedly, and ultimately the use of wampserver.

Wampserver Introduction

Wamp is the Windows Apache Mysql PHP integrated installation environment, which is the Apache, PHP and Mysql Server Software under window. It is also an installation that does not require you to configure the environment.

Current version updated to Wampserver 2.2E, including version: Apache 2.2.22, Mysql 5.5.24, PHP 5.4.3, XDebug 2.1.2, XDC 1.5, PhpMyadmin 3.4.10.1, Sqlbud Dy 1.3.3, Webgrind 1.0.

Wampserver Download and install

Official address: http://www.wampserver.com/en/(support 32-bit and 64-bit systems, choose version according to your own system)

1. After downloading, run the installation directly, the installation process may ask you to set the default browser, the process is skipped.

2. Run Wampserver, in the lower right corner of the taskbar appears icon, Right-click on the icon, select the language for Simplified Chinese .

3. Left-click on the icon, the shortcut Management menu for wampserver appears, including the shortcut entry and service settings for various services:

Localhost: Default website home page, if open Display 403 Forbidden, you can manually enter http://127.0.0.1 to access

or open c:\windows\system32\drivers\etc. Modify the Hosts file to add a record

127.0.0.1 localhost

Save it.

Note: If you are prompted that you cannot save the Hosts file, your current system user may not have permission to modify it, please search for the solution yourself, or if some security software restricts the changes, temporarily exit the security software.

www directory : The root directory for storing web site files

phpMyadmin: You can manage your database through it, not use it, you can view the PhpMyadmin tutorial

Wampserver bind domain name, add virtual host

1. Bind the domain name you want to bind to 127.0.0.1 using the A record

2. Start the Wampserver service, left click on the lower right corner of the wampserver icon, open the Apache menu "httpd.conf" file, find "# Include conf/extra/httpd-vhosts.conf", put this sentence before the #号去掉, a reference to the virtual host configuration file httpd-vhosts.conf is enabled.

3. In the Confextra directory of the Apache installation directory, such as mine is D:\wamp\bin\apache\apache2.2.22\conf\extra, Open httpd-vhosts.conf with Notepad, the most bottom you'll see 2 virtual host samples, one of which is modified to the type below, to remove the superfluous sample:

1234567
<virtualhost *:80>    ServerAdmin [email protected]    documentroot "d:/wamp/www/xxx.com"    ServerName www.xxx.com    errorlog "Logs/www.xxx.com-error.log"    customlog "Logs/www.xxx.com-access.log" common</ Virtualhost>

4. Left-click on the wampserver in the tray to restart all services;

5. Open the Hosts file under the C:\windows\system32\drivers\etc directory with Notepad and add a line at the bottom:

127.0.0.1 www.xxx.com

6. Under the browser input www.xxx.com, you can see the HTTP has been accessed to the local d:\wamp\www\xxx.com directory, after you just put this site's files in this directory.

7. If you want to add multiple virtual hosts, repeat the above actions.

Wampserver Configuring Pseudo-static

By default, Wampserver does not support pseudo-static, and we need to do some configuration

1. Start the Wampserver service, left click on the lower right corner of the wampserver icon, open the Apache menu under the "httpd.conf" file;

2. Search to find "LoadModule rewrite_module modules/mod_rewrite.so" This line, remove the previous "#";

3. Find "allowoverride None" and replace it with "allowoverride all";

4. Restart all services of Wampserver

5. Create a new. haccess file, put it in the root of the current Web site, add pseudo-static rules to the. haccess file, such as adding WordPress pseudo-static rules

1234567891011
# BEGIN Wordpress<ifmodule mod_rewrite.c>rewriteengine onrewritebase/rewriterule ^index.php$-[L]RewriteCond%{ Request_filename}!-frewritecond%{request_filename}!-drewriterule. /index.php [l]</ifmodule> # END WordPress

Note: The pseudo-static rules of each station program are different, please add them according to your own needs.

Use Wampserver to build a local PHP environment, bind domain names, configure pseudo-static

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.