Php 5.3 environment configuration method (apache2.2 mysql5.1)

Source: Internet
Author: User
Tags mysql tutorial

This php 5.3 environment configuration method uses the configuration of Apache2.2.16 + PHP5.3.3 + MySQL5.1.49. Let's take a look at the installation configuration tutorial.

In this php tutorial 5.3, the Environment configuration method is to use the configuration of apache2.2.16 + php5.3.3 + mysql tutorial 5.1.49. Let's take a look at the installation configuration tutorial.

Step 1: Download the installed file
1. mysql: mysql-5.1.49-win32.msi;
2. apache: httpd-2.2.16-win32-x86-openssl-0.9.8o.msi;
3. php5.3.3 php-5.3.3-win32-vc6-x86 Note: Be sure to download the php-5.3.3-win32-vc6-x86 version
, Do not download the php-5.3.3-nts-win32-vc6-x86 version, do not download vc9 version, because he is the iis Server Installation version.
Step 2: Install the file
1. Create a folder on the disk to be installed (the author created a php folder d: php under the root directory of drive d ).
2. Install the apache server. The directory after installation is d: phpapache.
3. decompress the downloaded php-5.3.3-win32-vc6-x86 in the d: php Directory, you can change the folder name to short, the result is d: phpphp5
4. Install the mysql database tutorial. The installation is the same as normal. I installed him in the same directory as (d: phpmysql) and php.
Step 3: Configure php5.3.3
1. configure php5.3.3 and open the php installation directory (d: phpphp5). You can see that there are two such files under the Directory: php. ini-development and php. ini-production: the first is the development configuration file, and the second is the configuration of the standard production environment.
2. Select php. ini-development to copy a copy to the same directory and change it to php. ini. Use a text tool to open it and search for extension_dir.
Select the one on windows: and change the semicolon to extension_dir = "d:/php/php5/ext ".
According to your own directory structure configuration, the purpose is to find the extension library in the ext folder in the same directory as php. ini.
3. Find extension = php _ and remove extension = php_curl.dll, extension = php_gd2.dll, extension = php_mbstring.dll,
Extension = php_mysql.dll, extension = php_mysqli.dll, extension = php_pdo_mysql.dll, extension = php_xmlrpc.dll
. Search for short_open_tag = off and change it to short_open_tag = on to support short tags.
4. Copy the php5ts. dll file to the windows/system32 directory, only the php-5.3.3-win32-vc6-x86 version has php5ts. dll
The php-5.3.3-nts-win32-vc6-x86 version is not available.
Step 4: Configure apache
1. Open the httpd. conf file in the conf directory under the apache directory and search for # loadmodule. At the end of the file, there are about 128 lines.
Add:
Loadmodule php5_module "d:/php/php5/php5apache2_2.dll"
Phpinidir "d:/php/php5"
Addtype application/x-httpd-php. php
Addtype application/x-httpd-php. htm
Addtype application/x-httpd-php. html
The directory structure is configured according to the user's own directory.
2. Search for directoryindex index.html and change it to directoryindex index. php default. php index.html index.htm default.html
Default.htm
3. Search for documentroot and change it to the folder where you want to place the web files (I created
Www folder) So documentroot is documentroot "d:/php/www". You can modify it according to your own configuration.
4. Search for the <directory "d:/php/www"> documentroot path configured for you (the author is <directory "d:/php/www">)
Step 5: test whether the configuration of php + apache + mysql is successful
1. Open mysql and create a new database and table in mysql. (The userinfo database and users table have the id and name fields)
Test? It's easy, huh, huh !!
2. Create an index. php file in the www folder created above and use editplus or another text tool to open it.
3. Write:


Copy the Code as follows:

<?
$ Db_host = "localhost ";
$ Db_user = "root ";
$ Db_pass = "root ";
$ Db_name = "userinfo ";

Mysql_connect ($ db_host, $ db_user, $ db_pass );
Mysql_select_db ($ db_name );

Mysql_query ("set names gb2312 ");
$ SQL = "select * from users ";
$ Result = mysql_query ($ SQL );
While ($ data = mysql_fetch_array ($ result )){
Echo "------------------------";
Echo $ data ['id']. "<br/> ";
Echo $ data ['name']. "<br/> ";
}
Mysql_close ();
?>

4. Start the apache server, enter http://www.bKjia. c0m in the browser and press Enter.
If we see: we are done! Congratulations!

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.