Manually configure apache + php + mysql under win7

Source: Internet
Author: User
Tags phpinfo


Manually configure apache + php + mysql in win7 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 by www.2cto.com 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. Obviously, they are relatively new installation packages. 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. conf file, make the following adjustments: ServerRoot "D:/Apache2.2" Server Installation root directory DocumentRoot "D: /phpWeb "changed to the root directory of your website # This shoshould be changed to whatever you set DocumentRoot. <Directory "D:/phpWeb"> synchronize and modify with the previous step # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. <IfModule dir_module> set the default requested file DirectoryIndex Index. php index.html </IfModule> LoadModule php5_module "D:/php/php5apache2_2.dll" loads php in the module mode. Note that the apache version LoadFile corresponding to php5apache2_2.dll "D:/php/php5ts. dll "manually load the php dynamic link library or put these two files in the directory of system32 file LoadFile" D:/php/libmysql. dll "load mysql dynamic link library PHPIniDir" D:/php "non-essential configuration AddType application/x-httpd-php. php. html. after the htm server supports saving and modifying the dynamic file type, test apache and restart the apache server. Enter the localhost or loopback address in the browser. The "It works!" page is displayed!" In this case, apache is working. Test php and edit an index. php file in the php web directory. The content is <? Php phpinfo () ;?>, Repeat the operations on the apache server. The page displays the configuration information of php and checks whether the SQL module is included. However, php does not load the mysql module by default. Then modify the php. ini file. The main changes are as follows: extension_dir = "D:/php/ext .................. Extension = php_mysql.dll open mysql extension for php. ini modification is quite depressing, a lot of online has been found and made a variety of changes, seem to understand and want to try, and later did not work. 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 specified 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.