PHP installation for PHP environment configuration on Windows Platform

Source: Internet
Author: User
Tags net domain
Windows platform PHP environment configuration of PHP installation article: http://www.phpiask.com /? P = 43 getting started very well in the last two articles in this series: Mysql installation and configuration. in Apache installation, we installed databases and Web servers, in a twinkling of an eye, we talked about our focus on PHP. PHP installation for PHP environment configuration on Windows

Original: http://www.phpiask.com /? P = 43 great entry

In the last two articles in this series: Mysql installation and configuration, we installed databases and Web servers in Apache installation. in a twinkling of an eye, we talked about our key PHP.
I have heard of at least two statements about why PHP is called PHP, but it doesn't matter. Just like Xie Xun is sometimes called King of kingmao, we know that he is just him.

The first step is of course to download, here: http://www.php.net
Remember that the net domain names are not com. they are completely different.

Click the download link on the page to go to the download page, find the Windows Binaries title, and find the PHP 5.0.4 zip package link to download it. Do not take it for granted that we do not download the Installer file because it does not contain Mysql extensions. if you download it for installation, it will be troublesome-it can also be solved. But we should download the zip package.

After the download is complete, decompress the package and decompress it to D: \ php;
Find a file named php. ini-recommended, copy the file to the Apache Directory, and change the name --. The name should be changed to php. ini.

Note: the order in which Apache searches for php. INI files is as follows:

First, the apache Directory, then the system directory, and then the directory specified by path. Therefore, it is easier to find the Directory in Apache ......

In this case, the PHP installation is complete. although he cannot work with Apache, he has completed the installation. Really!

Can't I install it for work? -- Don't get angry, brother. The battlefield is not over yet. let's combine Apache and PHP to let them get on the road together.

Do you still remember if we installed the Apache Directory? I remember! In D: \ apache
Open this directory, find the conf folder, and find a file named httpd. conf. this is the Apache setting file. remember that there will be many places to use later. Open the file in Notepad.

Search for ScriptAlias and you will see something similar to the following:

#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essential the same as Aliases, doesn't that
# Events in the realname directory are treated as applications and
# Run by the server when requested rather than as your Ents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as
# Alias.
#
ScriptAlias/cgi-bin/"D:/apache/cgi-bin /"

For/cgi-bin/, this entry tells Apache how to process any URL containing the cgi-bin directory. For example, if you requested a http://www.phpiask.com/cgi-bin/mail-me,Apache, it would not look for a file named mail-me in the cgi-bin directory. Instead, the ScriptAlias command tells Apache to view another Directory-In this example, the directory is "D:/apache/cgi-bin /". This is critical because you do not want to store scripts in a directory that can be accessed through the Web. Therefore, you need to add an entry for the PHP script. As follows:

ScriptAlias/php/"D:/php /"

Next, you need to tell Apache. files ending with php must be processed by applications. in particular, you want to assign a type to the PHP files and then you can instruct Apache to process them in a specific way. Under the ScriptAlias entry, add the following entry:

AddType application/x-httpd-php. php
This is not enough. let's look back. we only told Apache how to map a directory and handle a file with the php extension. we haven't told him yet, who will handle this? It's like dying (the head of "my head, my team") said, "we should eat a rabbit ", he didn't say who should eat it -- it would be very troublesome.
Now let's specify who should handle php extension files:

Action application/x-httpd-php "/php/php-cgi.exe"

See it? We directly handed the. php extension file to the php-cgi.exe file under my php/directory for processing. you may ask which php directory it is, and we can see that our first setting is not:

ScriptAlias/php/"D:/php /"
This is the directory ing file. Apache will know that/php/directory refers to D:/php/. is Apache very smart? Haha ......

Set the index file name, which is the default homepage file. search for DirectoryIndex and make the following settings:

DirectoryIndex index.html. var index. php

Restart Apache, control panel-> service-> find Apache and restart
So far, your Web server has basically been completed, and Apache can also run the. php program. let's take a look. Compile the first php file phpinfo. php with the following content:
Phpinfo ();
?>
Put it in the htdocs folder of the apache Directory and enter http: // localhost/phpinfo. if you run php, you will see a page that contains all the PHP settings, including the php. ini location.

Another problem is how PHP connects to Mysql. let's solve it here.

Find the PHP setting file D:/apache/php. ini. As mentioned earlier, in the apache installation directory, open the search extension_dir and set it
Extension_dir = "D:/php/ext,
Search extension = php_mysql.dll
Remove the previous ";" and enable Mysql extension

Restart Apache again, and restart http: // localhost/phpinfo. php. if it is still smooth, you will see a Mysql module on this page. take a closer look and you will certainly have it.

So far, Apache, Mysql, and PHP have been installed and integrated. you can start programming!
This installation process is only one of the many installation methods. Of course, there are still many things to say about the PHP and Apache settings. please pay attention to the php. ini configuration overview and httpd. conf configuration overview introduced later on this site.

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.