Manually configure apache + php + mysql under win7

Source: Internet
Author: User
Welcome to the Windows community forum and interact with 3 million technical staff. I wanted to learn php, so I wanted to build a web server and SQL environment, which wasted a lot of time. In a general summary, it is also a long memory. The installation packages used are httpd-2.2.22-win32-x86-no_ssl.msi,php-5.2.5-win32.zip and mysql-ins.

Welcome to the Windows community forum and interact with 3 million technical staff> I wanted to learn php, so I wanted to build a web server and SQL environment, which wasted a lot of time. In a general summary, it is also a long memory. The installation packages used are httpd-2.2.22-win32-x86-no_ssl. msi,php-5.2.5-win32.zip and mysql-ins

Welcome to the Windows community forum and interact with 3 million technicians>

I wanted to learn php, so I wanted to build a web server and SQL environment, which wasted a lot of time.

In a general summary, it is also a long memory.

The installation packages used are httpd-2.2.22-win32-x86-no_ssl. msi,php-5.2.5-win32.zip and mysql-installer-community-5.5.28.3.msi, it is clear that the new installation packages are used. It is still relatively smooth to install apache. After installation, it listens to port 80 of all the ip addresses of the Local Machine by default, including the loopback address, decompress php to the specified folder, and install mysql, open httpd in the installation directory. make the following adjustments to the conf file:

ServerRoot "D:/Apache2.2" Server Installation root directory

Modify DocumentRoot "D:/phpWeb" to the root directory of your website.

# This shoshould be changed to whatever you set DocumentRoot.

   Synchronize modification with the previous step

# DirectoryIndex: sets the file that Apache will serve if a directory

# Is requested.

   Set the default file to be requested

DirectoryIndex index. php index.html

  

LoadModule php5_module "D:/php/php5apache2_2.dll" loads php as a module. Note the apache version corresponding to php5apache2_2.dll.

LoadFile "D:/php/php5ts. dll" manually load the php dynamic link library or put the two files in the system32 directory.

LoadFile "D:/php/libmysql. dll" load mysql Dynamic Link Library

PHPIniDir "D:/php" unnecessary Configuration

AddType application/x-httpd-php. php. html. htm the server supports dynamic file types.

Save the changes, test apache, restart the apache server, and enter the localhost or loopback address in the browser. The page displays "It works! "In this case, apache is working.

Test php and edit an index. php file in the php web directory. The content is Repeat the apache server operation. The page displays the php configuration information to check whether the SQL module is included. If not, php does not load the mysql module by default. Modify the php. ini file as follows:

Extension_dir = "D:/php/ext": Location of the extended dll library

......

Extension = php_mysql.dll open mysql extension

The changes to php. ini are quite depressing. I have made a lot of changes on the Internet, so I tried them if I was not familiar with them. Later I did not use them. Check whether mysql is successfully installed. Run the command line to check whether port 3306 is listening. Run the netstat-a command to check whether the connection to the database is successful using mysql workbench, if the result is successful, mysql installation is normal. The mysql configuration file is my. ini. It is not required for the moment. The default configuration can work. So the problem lies in the connection between php and mysql, and the problem must be the php. ini file.

Check the php. ini file. Check the information provided by phpinfo (). It seems that there is no mysql module. I began to wonder if I opened the mysql extension in the configuration information. God, open extension = php_mssql.dll. No number is allowed here.

Wahtever, the problem was finally found, tested, and instantly OK, ready to cry. However, looking back at the entire process, time is mainly wasted on small errors. To sum up the lesson, Baidu and google cannot leave behind their doors to build a car, but cannot blindly trust and blindly follow the rules. In the face of problems, they are constantly concerned about the problem and analyze the problem by themselves.

Next, analyze httpd. conf php. ini my. ini in detail, configure it flexibly, optimize the performance of the web server and database server, and then port the website to the newly emerging Nginx web server. It seems to be a bit biased. Of course, the main goal is to learn cute PHP.

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.