Original: PHP 1: Install and configure Php,apache and my SQL on Windows
If you google a similar theme, you will find that the relevant articles can be stuffed with your hard drive. The reason here is to take it out again is to record how I was configured as a novice and some of the problems encountered during configuration. Some of these problems are expected to be useful to everyone.
Downloading the installation files is needless to say.
But let's just mention the version.
- php:5.1.4
- Apache 2.2.3
- Mysql:5.0.2-community-nt
The order of my installation is as follows:
- Install PHP
- Installing Apache
- Install MySQL
- PHP Installation
Some people think that the above installation sequence and normal installation order a little bit in and out, yes, indeed. In general, install Apache First and then install PHP.
In the installation of PHP, there is an episode, I downloaded the PHP msi package, but this package after installation found no Dev,ext and other directories, and the provided install.txt file is too large. I began to think that my machine has a problem, and then installed once again, found and the original is still the same, and then a bit dizzy, and then to the PHP website on a look, the original MSI download behind a description, a crazy dizzy, directly against the wall. So under the zip bag to do, probably more than 8M. Alas, it is too careless. So
Be sure to download the correct installation package。
2. Apache Installation
First of all, Apache installation is a bit of a point.
When installed, it will prompt an important choice: Select the port and user, the default is for all users to install, And the port is 80. However, another option is provided, that is, the current user, and the port is 8080. If the machine's IIS chooses a port of 80, and you choose the default way, it is obvious that there is a problem when installing the Apache service because the port is already applied. If you choose the latter one, it will not give you the Apache service installed.
The following is a question about the installation service I have encountered.
I chose the second, that is, the current user, the port is 8080, the result is not automatically installed Apache service, so look at the install file, found that the Apache application can be installed manually, so according to his said run to the bin directory, found no Apache.exe. So open the Apache configuration file, set up a unused port, reinstall Apache, but the choice is the first way, this time incredibly good.
prompt, be sure to select the appropriate port number and the user of the service, especially the machine with IIS installed。
After the above loading, the most tedious thing is to configure. It might be a piece of cake for Linux or UNIX users, but for Windows users, it might be a bit of a challenge for Microsoft to be the creator of a fool-friendly software talent.
Configuration of the article is many, I do not mention, only to mention the more important points of personal thought.
- Write a bat file before the configuration. What is this bat file for? is to test whether the Apache file syntax is correct. The contents of the bat file can be:F:\Apache software foundation\apache2.2 is the directory where Apache is installed. "F:\Apache Software Foundation\apache2.2\bin\httpd.exe" -W-T-F"F:\Apache Software foundation\apache2.2\conf\httpd.conf" -D"F:\Apache software foundation\apache2.2\."The benefit of doing this is to go to the command line and run the file directly to see the results.
- Configure the PHP DSO module. This comparison makes life annoying, because PHP provides Php5Apache2.dll incredibly in Apache2.2.3 not apply, still have to download a patch to do. This patch is everywhere, with Google entering Apache Php5Apache2.dll, which is now thousands.
- LoadModule This guy is really disgusting. I input LoadModule php5-module f:/php/php5apache2.dll , the php5-module mistakenly write as Php5-mdoule, actually told me wrong. Dizzy. So far I have no idea why. Why is it?
To test whether PHP and Apache work properly, write a simple php file.
1<?PHP
2 Phpinfo();
3?>It shows PHP and Apache information.
3 MySQL installation
This is relatively simple, modify the php.ini extension, and then copy the extension DLL. So easy.
We recommend downloading phpMyAdmin to operate MySQL.
4 Summary
Many people think the configuration is a bit difficult, and I thought so. Now I don't think so, because I think mastering its essence, I know the simple degree of configuration. Online
Articles about configuration abound, but few people speak the essence of it. If you often operate on a Linux or UNIX platform, don't say it. Conversely, if you are a user of Windows,
You are most likely to use IIS, and I am one of them.
If you understand IIS, or in other words, how IIS executes asp,asp. NET and other pages, I believe you can configure apache,php and so on is not a difficult thing.
To get to the chase, configuring Apache and PHP is similar to IIS and ASP. Microsoft, however, has simplified the configuration of IIS and ASP, considering the user's configuration.
A PHP page must first pass through the parsing and so what, this through what to do? That's PHP's own interpreter. So you need to putPhp5ts.dllThis guy tests the Windows system directory so that Apache can call it, and the whole system can call it. So why does PHP know about virtual directories (or root directories)? That's php.ini.Doc_rootSetting the content, someone asked what it was. Quite simply, it is the virtual directory path in IIS. One would ask, so how does PHP handle mysql? The problem is very good and critical. Why is php linked to MySQL? PHP is unlikely to be born, and this time it needs an extension,php.iniHave aExtension_dirItem, which is used to specify the path of the extension. But this is a directory that contains a lot of extensions, MySQL, Sybase, SQL Server, so how do I specify the extensions I want? The answer is very simple, or php.ini file, there is a
extensionItem, if you want to extend MySQL, you can thinkExtension=php_mysql.dll, other similar.
The above is mainly the explanation of PHP, the following a little bit about Apache it. Remember in IIS, if you want to add a MIME type, very simple, but in Apache, there is no interface for you to press a few buttons on the line. It requires you to openhttpd.conf, such as adding PHP types, can be written toaddtype application/x-httpd-php. PHP, Word can assume thatAddTypeApplication/msword. doc. It's simple.
By the above explanation, I believe you are no longer so afraid of the configuration.
Next I will learn these things through an example!
PHP 1: Install and configure Php,apache and my SQL on Windows