PHP Manual Setup Environment

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

Copy the My-default.ini under the root directory and change the name to My.ini,my.ini replace with the following

[client]port=3306default-character-set=utf8# client character type, consistent with server, recommended utf8[mysqld]port=3306character_set_server=utf8# Service-side character type, it is recommended to utf8basedir=d:\lamp\mysql-5.6.17-winx64# the directory datadir=d:\lamp\mysql-5.6.17-winx64\data# solution to the directory \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:

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:

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

C:\Documents and SETTINGS\ADMINISTRATOR>CDC:\>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 prompt: Service successfully installed. And the installation is successful. (cmd command: cd\  return root d: Enter D  CD lamp into the  lamp folder)

 

Start, stop, move out of MySQL service start MySQL service  : net start mysql stop MySQL service:  net stop mysql  remove MySQL service: Mysqld-remove here to start the service, Easy to do next.

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 http-t 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):

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:

<?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

<?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:

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.

 

PHP Manual Setup Environment

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.