Wamp environment configuration; www.cnblogs.com/cyrfr/p/6483529.html's Blog

Source: Internet
Author: User
Tags php language

PHP Manual Build environment has many combinations, the version number is inconsistent, will lead to build failure.

The combination I built is: php5.6+mysql5.6+apache2.4.

First, PHP language pack download

First download php5.6 http://windows.php.net/download#php-5.6 from official website

Select the full version of the download:

Second, Apache server download

First download Apache2.4 http://httpd.apache.org/download.cgi from official website

Go to the second interface and select the second option:

Depending on the computer, select the appropriate number of digits:

Note that there is a sentence:

The general meaning is that after the configuration of Apache, to run ApacheMonitor.exe, may be reported missing DLL files, if the report is missing files, you need to download the software.

Download the good Apache2.4 and continue downloading MySQL 5.6.

Third, the MySQL 5.6 service download.

I'm using mysql5.6.17 this version of the website: https://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-17.html

may be slow to download the official website, you can also directly online search.

There are two types of this file, one is the installation version (the file at the end of the MSI), and the other is the free-install version (the file at the end of the zip)

Both of them are possible.

Note: There's something in the database that's best to back up .

I am using the free install version, I feel that this version produces fewer errors. Here's how to install the free version:

Unzip to the custom directory, I unzipped the directory is D:\LAMP\mysql-5.6.17-winx64

Rename the My-default.ini under the root directory to My.ini,my.ini replace the contents with the following.

12345678910111213141516 [client]port=3306default-character-set=utf8#客户端字符类型,与服务端一致就行,建议utf8[mysqld]port=3306character_set_server=utf8#服务端字符类型,建议utf8basedir=D:\LAMP\mysql-5.6.17-winx64#解压根目录datadir=D:\LAMP\mysql-5.6.17-winx64\data#解压根目录\datasql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES[WinMySQLAdmin]D:\LAMP\mysql-5.6.17-winx64\bin\mysqld.exe#解压根目录\bin\mysqld.exe

 

Note this remark:

1 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

What is set here is that if you want to add empty data to a column in a table, you cannot use the ' way, you must write NULL and cannot be quoted.

If you want to use ' the way, change this sentence to:

1 sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Environment variable Configuration

My Computer-Properties-advanced-environment variables-NEW

Variable Mysql_home value D:\LAMP\mysql-5.6.17-winx64

Find the variable path edit, add it at the back;%mysql_home%\bin

Run the input cmd, or locate the C:\Windows\System32\cmd.exe, and go to the MySQL decompression directory bin subdirectory

123456789 C:\Documents and Settings\Administrator>cd\C:\>d:D:\>cd LAMPD:\LAMP>cd mysql-5.6.17-winx64D:\LAMP\mysql-5.6.17-winx64>cd binD:\LAMP\mysql-5.6.17-winx64\bin>D:\LAMP\mysql-5.6.17-winx64\bin>mysqld -install提示:Service successfully installed.及即安装成功。(CMD命令:CD\  返回根目录 D: 进入D盘  cd LAMP  进入LAMP文件夹)

 

12345 启动、停止、移出MYSQL服务  启动MYSQL服务:net start mysql  停止MYSQL服务:net stop mysql  移出mysql服务:mysqld -remove这里启动服务,方便下一步操作。

The configuration is done.

If the file ends in MSI, the installation process is:

Enter this interface and select the second custom setting path

Select the default option,

The password is set here.

After MySQL is installed, you can start configuring the development environment.

Apache Installation Configuration

1, extract the downloaded Apache2.4 to the custom directory, the directory I choose here is the amp directory of D drive.

2. Open Apache Extract Directory Conf folder under the httpd.conf file:

Find all the C:apache24 to modify it to your own extracted directory, there should be several places need to change, directly use the Notepad replacement function.

Replace and then open the cmd command line, enter httpd-k install and then check the syntax, as follows:

Red text appears, then succeeds.

3, next launch Apache service, test whether the installation is successful, open Apache Bin directory under the ApacheMonitor.exe (if the open prompt is missing DLL file, then you need to install the above mentioned VC, after installation can open this monitor), opened as follows:

4. Testing

Enter the localhost return in the browser and see the Apache installation as described.

In fact, the browser display of it works is the Apache default site Htdocs (in fact, located in the Apache Directory Htdocs folder) under the default home page index.html content. Since then, Apache has been successfully installed, and then PHP needs to be configured so that Apache and PHP work together (PHP as a module of Apache).

This folder Htdocs is the root directory to run as PHP files, all the PHP files must be placed in this area to run.

Configuring the PHP module to the Apache server

1, in the apache24/conf/httpd.conf to do the following configuration:

Add the following code at the end of the file (note modifying the path):

1234 LoadModule php5_module D:\AMP\php-5.6.30-Win32-VC11-x64\php5apache2_4.dllAddType application/x-httpd-php .phpLoadModule php5_module modules/libphp5.soPHPIniDir D:\AMP\php-5.6.30-Win32-VC11-x64

  

After that, restart the Apache server (the configuration file will be restarted).

2, in the Apache Htdocs directory to build a PHP file, here is called index.php, in this file write the following content:

123 <?php echo "hello php world!";?>

Enter localhost/index.php in the browser to see:

Apache configures PHP to be successful, then needs to be configured to do some PHP related configuration and to configure MySQL to PHP.

PHP Configuration

To configure the time zone:

Open the PHP unzip directory, locate the php.ini-development file, rename it to PHP.ini, and open it with Notepad.

Find (with semicolon);d Ate.timezone =

Remove the previous sub-good, modify it to Date.timezone = Asia/shanghai

Test: Write the following code in the Index.php folder in the root directory

1234 <?php echo  date("Y:m:d H:i:s");?>

The browser runs if the current time is displayed, the configuration time zone is successful.

Configure MySQL

1. Open the php.ini file to find the Extension_dir keyword

Remove the previous comment and change the ext file path to our own ext path, which is modified to:

1 extension_dir = "D:\AMP\php-5.6.30-Win32-VC11-x64\ext"

2. Continue to find Php_mysql keywords in php.int

Remove the semicolon in front of the two items in the diagram. If later in PHP run, the missing extension, the corresponding content can be removed before the semicolon.

3, set the code:

Find Default_charset =

Change it to:

Default_charset = "UTF-8"

Now that the PHP environment is set up, you can put the PHP file in the Htdocs folder and run it.

Wamp environment configuration; www.cnblogs.com/cyrfr/p/6483529.html's Blog

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.