Set up the PHP development environment apache + MySQL + PHP to install the phpMyAdmin module

Source: Internet
Author: User
Tags mysql download php session php development environment utc greenwich vc9 zip extension
Set up the PHP development environment apache + MySQL + PHP to install the phpMyAdmin module phpmyadminApache

The reference for this blog is from:

Http://wenku.baidu.com/view/0e4c569ddd3383c4bb4cd267.html

Http://www.cnblogs.com/pharen/archive/2012/02/06/2340628.html

Http://www.admin10000.com/document/54.html

Http://blog.csdn.net/zutsoft/article/details/21651041

It took almost one day yesterday to build the WAMP environment after skipping numerous pitfalls. The reason is that you do not understand and do not know. the Latest apache version and the latest php5.5 version are incompatible. There is also the difference between Thread safe and no thread safe versions. the differences between VC6, VC9, and VC11 in PHP are recorded. Including a variety of content learned by Google.

1. prepare and download the software

Note: The following is my version.

Apache: httpd-2.2.22-win32-x86-openssl-0.9.8t.

: Http://www.apache.org/

MySQL: mysql-installer-community-5.6.19.0.msi

: Http://dev.mysql.com/downloads/windows/installer/

PHP: php-5.3.1-Win32-VC6-x86

: Http://windows.php.net/downloads/releases/archives/

2. start software installation

(1) install apache

Double-click installation is no different from installing other Windows software. when you enter Server Infomation, there are no special rules as long as the entered information conforms to the format.

(Note: Select the installation type here. I usually select Custom. here, you can set the installation path as needed)

After the installation is complete, enter http: // localhost in the browser. if It Works is displayed !, Indicates that Apache is successfully installed.

(2) install PHP

Install PHP: Extract php-5.3.1-win32-vc9-x86.zip to a directory.

(3) install MySQL

In the following example, the error MySQL was downloaded yesterday, causing a headache. we recommend that you download it from the official website. The link I posted above indicates that the downloaded version is OK.

Double-click the installation. to change the installation directory, go to Choose Setup TypeSelect Custom (I prefer Custom installation. we recommend that you select Custom M.)

After the MySQL download is complete, find the file downloaded to the local device and follow the steps below to install it by double-clicking:

Step 1: Double-click the MySQL installer (mysql-installer-community-5.6.10.1), as shown in 1.4:

Step 2: Click the "Install MySQL Products" text in. 4 to bring up the user license agreement window, as shown in 1.5:

Step 3: Select the select box in front of "I accept the license terms" and click the Next button to go to the page where you can find the latest version, as shown in Figure 1.6:

Step 4: click Execute to go to the installation type setting page, as shown in Figure 1.7.

Step 5: Select the "Custom" option in. 7 to modify the installation path or retain the default value, and then click [Next]. the Function selection page is displayed, as shown in figure 1.8.

Step 6: click Next to bring up the installation condition check page, as shown in 1.9.

Step 7: click Next to install the SDK, as shown in Figure 1.10.

Step 8: click Execute to start installation. After the installation is complete, the settings in the installation wizard take effect after the installation is complete, as shown in the window 1.11.

Step 9: click Next to go to the server configuration page, as shown in Figure 1.12.

Step 10: click Next, as shown in Figure 1.13.

The "Config Type" drop-down list item under "Server Configuration Type" in. 13 is used to configure the class Type in front of the Server. Which server will affect the memory, hard disk, and process or usage decisions of the MySQL Configuration Wizard? you can select the following three server types:

Developer Machine: This option represents a typical personal desktop workstation. Assume that multiple desktop applications are running on the machine. Configure the MySQL server to use the least amount of system resources.

Server Machine (Server): This option indicates the Server. the MySQL Server can run with other applications, such as FTP, email, and web servers. Configure the MySQL server to use the appropriate proportion of system resources.

Dedicated MySQL Server Machine (Dedicated MySQL Server): This option indicates a Server that only runs the MySQL service.

It is assumed that no other application is running. The MySQL server is configured to use all available system resources.

As a beginner, it is enough to select "Developer Machine" (Developer Machine), which will not occupy a lot of system resources.

Enable or disable the TCP/IP network in the check box on the left of Enable TCP/IP Networking and configure the port number used to connect to the MySQL server. by default, the TCP/IP network is enabled, the default port is 3306. To change the port used to access MySQL, enter the new port number in the text input box, but ensure that the new port number is not occupied.

Step 11: click Next. in the interface corresponding to 13, we need to set the password of the root user, in "MySQL Root Password" (enter the new password) and "Repeat Password" (OK) enter the expected password in the two edit boxes. You can also click Add User to Add a new User. (Note: The Current Root Password is blank. if you enter the Password, an error will be reported for subsequent installation)

Step 12: click Next to set the Windows Service Name <可默认> , This name is the name of the database service to start. remember.

The effect is shown in 1.14.

Step 13: click Next to open the configuration information display page, as shown in 1.15.

Step 14: click Next to complete the installation and configuration of the MySQL database. Next, you can log on to our MySQL database to perform operations.

Example: start MySQL

You can directly use the command line:

3. integrate Apache + MySQL + PHP

(1)Configure Apache

Use the text editing tool (EditPlus recommended) to open E:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd. conf file, which is the Apache configuration file. the following steps are all about modifying the file content. Note that you must restart the Apache service after modifying the httpd. conf file. The new settings will take effect.

1. let Apache load the PHP module

Find # LoadModule vhost_alias_module modules/mod_vhost_alias.so (approximately 128th rows) and add the following content after this line:

LoadModule php5_module "E:/StuSoftware/PHP/php/php5apache2_2.dll"AddType application/x-httpd-php .phpPHPIniDir "D:/WAMP/PHP"

LoadModule php5_module "E:/StuSoftware/PHP/php/php5apache2_2.dll"/* you need to download the version of VC6. Otherwise, you cannot find php5apache2 -- 2. dll file. this is one of the pitfalls I have encountered. I will talk about it later *

This statement loads the PHP5 module in module mode.

AddType application/x-httpd-php. php

The file with the. php extension is executed as a php script. You can use any other extensions you like, such as. html,. php5, or even. txt, to execute PHP.

PHPIniDir "D:/WAMP/PHP"

This statement is used to specify the directory where the PHP configuration file php. ini is located.

If Apache 2 runs php5 in the module mode, you can use the PHPIniDir command.

2. modify the website storage directory

We know that ApacheThe default website directory is the htdocs folder under the Apache installation directory.When you change the website storage directory, you must modify the corresponding Apache configuration.

In the configuration file httpd. conf, find DocumentRoot (probably in line 182) and change it to the correct folder pointing to the website directory. Here we change

DocumentRoot "F:/Workspace/PHP"

At the same time, find This shoshould be changed to whatever you set DocumentRoot to (approximately 207 rows), and there is a line below it Modify the DocumentRoot path configured for you. Here we modify it:

 

My website's storage directory is like this:

3. modify the home page file of the Directory

In the configuration file httpd. conf, find DirectoryIndex index.html (approximately in line 244) (shortcut key search and press ctrl + F) and change it:

DirectoryIndex index.html index.htm index.php

DirectoryIndex refers to the default file executed by Apache when the client browser accesses a directory.

Take our modification as an example: when a user clicks a directory, apachewill go to the index.html under the Directory. If no index.htm is available, no index. php is available. If none of them are found, the file list in this directory is displayed by default. Reference: to prevent Apache from displaying the file list

(2) configure PHP

Open the PHP installation directory, E:/StuSoftware/PHP/php. we can see that there are two such files under the Directory: php. ini-development and php. ini-production: The first is the configuration file used for development, and the second is the configuration of the production environment. because we develop on the local machine, select the former. Copy php. ini-development to the same directory and rename it php. ini. This php. ini is the configuration file currently in use. the following steps are to modify the content of this php. ini file. Note that after modifying the php. ini file, you need to restart the Apache service to make the new settings take effect.

1. specify the directory for storing the PHP Extension Library

In Windows, PHP extension libraries are usually stored in the ext directory of PHP in the form of DLL. Use a text tool to open the php. ini file and find extension_dir = "ext" (approximately 809 rows), that is, the line under On windows. Replace the semicolon ";" in front of it with the following:

extension_dir = "E:/StuSoftware/PHP/php/ext"

Extension_dir indicates the Directory of the PHP Extension Library to call the corresponding DLL file.

2. enable the corresponding extension Library

By default, many PHP extension libraries are closed. for example, PHP does not support connection to the Mysql database by default, you need to enable the corresponding extension libraries.

Here we start some common extension libraries.

Search; Windows Extensions (approximately 941 rows), under which is the extension list.

Find the following extension:

;extension=php_curl.dll;extension=php_gd2.dll;extension=php_mbstring.dll;extension=php_exif.dll;extension=php_mysql.dll;extension=php_mysqli.dll;extension=php_pdo_mysql.dll;extension=php_pdo_odbc.dll;extension=php_sockets.dll;extension=php_xmlrpc.dll;extension=php_xsl.dll

Remove the semicolon ";" before the extension. If you want to load other extension modules in the same way, just remove the semicolon.

Tip 1: restart Apache and prompt "unable to load dynamic library... php_curl.dll". An error occurred while loading php_curl.dll. The solution is to copy libeay32.dll and ssleay32.dll under the PHP directory to the windows directory or the windows/system32 directory, as long as it is the Path included in the system Path environment variable. If you do not want to copy the file, you can directly put the PHP Path in the system Path environment variable. Right-click my computer and choose Properties> Advanced> environment variable => Path in the system variable. double-click it and add a semicolon (;) to your PHP Path. "Before (; D:/WAMP/PHP), add it to OK. Restart Apache.

Tip 2: The Exif extension is used to display the exif information of an image. because the extension requires the support of mbstring. dll, you must write the line extension = php_exif.dll to the end of extension = php_mbstring.dll.

Tip 3: If the PHP Extension Library cannot meet your needs, you can go to pecl.php.net to find and download the library you need. Windows users can go to pecl4win.php.net or the http://downloads.php.net/pierre/ to download the compiled DLL file, you can also go to the http://museum.php.net/php5/ to load the PECL collection compressed package.

Tip 4: many people are looking for php_zip.dll. In fact, PHP has integrated the zip extension and can be used directly. You can use Find the zip extension description.

Currently, MySQL provides two different versions for different users: MySQL Community Server: Community Edition, which is completely free of charge, but does not provide official technical support.

MySQL Enterprise Server: Enterprise Edition, which provides cost-effective data warehouse applications, ACID transaction processing, and complete commit, rollback, crash recovery, and RoW-level lock functions. However, this version is billed and officially provides technical support such as telephone and documentation.

Currently, the latest MySQL version is MySQL 5.6. you can download this software from the official website http://dev.mysql.com/downloads/

. On the MySQL official website shown in 1.2, click the "Download" hyperlink on the image or click the link on the left. Then, follow the prompts to Download the MySQL software to your local computer. Note that the database version is Windows (x86, 32-bit) and MSI Installer, as shown in Figure 1.3.

3. allow PHP to support short labels

In the php. ini configuration file, search for short_open_tag = Off (approximately in line 266) and change it to: short_open_tag = On to support short labels. Php code is generally included in After short_open_tag = On is set, you can write it in a more concise form: .

4. configure the PHP Session function

When using the session function, we must configure the session file storage directory on the server. We need to create a read/write Directory for the session, which is better independent from the website directory. The directory is created in D:/WAMP/sessiontmp, and then in php. ini configuration file; session. save_path = "/tmp" (approximately 1467 rows), remove the semicolon ";" and change it to the following:

session.save_path = "D:/WAMP/sessiontmp"

5. configure the PHP file upload function

Like session, when using the PHP file upload function, we must specify a temporary folder to complete the file upload function. Otherwise, the file upload function will fail. Create a readable directory folder D:/WAMP/fileuploadtmp, and find it in the php. ini configuration file; upload_tmp_dir = (approximately 875 rows), and modify it:

upload_tmp_dir = "D:/WAMP/fileuploadtmp"

PHP uploads files up to 2 MB by default. to upload files larger than 2 MB, see configure php. ini to upload files.

6. set the time zone

Search for the php. ini configuration file; date. timezone = (approximately 993 rows), remove the semicolon ";" and change it to the following:

date.timezone = PRC

Date. timezone is a newly added configuration parameter in PHP5.1, which is used to set the time zone. The default date. timezone is commented out, that is, the default time zone is UTC Greenwich Mean Time. Here we change to date. timezone = PRC (PRC, People's Republic of China, People's Republic of China), that is, the date uses the China time zone. In this way, the time difference is solved by eight hours.

(3) configure phpMyAdmin

Download the latest phpMyAdmin version from the official website at the beginning.

Decompress the package and copy the file to the root directory of the website. my files are F:/Workspace/PHP/phpMyAdmin.

Then access http: // localhost/phpMyAdmin/index. php in the browser

The differences between php VC6/9/11 and Threadsafe and no Threadsafe are described earlier:

VC6 is compiled using the Visual Studio 6 compiler. if your PHP is set up using Apache, select VC6. (Now PHP has no VC6 ).

VC9 indicates that PHP of this version is compiled with VisualStudio2008, while VC11 is compiled with VisualStudio2012. This means

If you download the version of VC9, you must first install VisualC ++ RedistributableforVisualStudio2008SP1,

If you download the version of VC11, you must first install VisualC ++ RedistributableforVisualStudio2012.

Build php first look at the version of the operating system, if it is Windows here: http://windows.php.net/download/

Is the operating system 32-bit or 64-bit? If it is 32-bit, select the version with "x86". if it is 64-bit, select the version with "x64. Then let's see what the WEB server is?For the IIS series, select the version with "Non Thread Safe". for the Apache httpd series, select the version with "Thread Safe ".. For Apache httpd, you need to check how the binary version is compiled. There are three types of compilation: VC6, VC9, and VC11 (Visual C ++ 6, Visual C ++ 2008, and Visual C ++ 2012 respectively ). This is troublesome: The latest version of PHP 5.5 has been compiled using VC11, and 5.4 is compiled using VC9. However, the latest version of Apache httpd is still compiled using VC6. This means an amazing fact: Apache httpd's official and PHP official versions are not compatible!

By now, all the installation is complete, and WAMP runs smoothly.

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.