Reprinted --- php configuration

Source: Internet
Author: User
Reprinted --- install the php environment before php configuration. it is often installed once. you have to re-configure it step by step because there is no record during re-installation. install it again today: in the installation and configuration process of apache and php in windows, we will make a record to make it necessary in the future. because mysql installation is too simple, we will not focus on it here.

The installation environment is windows. because I also need the debugging environment of asp + mssql (access), I added the debugging environment of apache + php + mysql on windows, the dual environment exists at the same time, so that I can switch over at any time.

Installation and configuration of Apache

Open the apache official website http://archive.apache.org/dist/httpd/binaries/win32/ or mirror site sites. The same version has two types: no_ssl and openssl. openssl has an ssl security authentication mode while its protocol is HTTPS instead of HTTP, this is the difference between servers with SSL and general web servers. Generally, we can download the no_ssl version.

After downloading the apache installation file, click Install. After three consecutive next times, the server information configuration page is displayed. you must enter the network domain, server domain, and website administrator email address, you can simply fill in the format. After you press Next again, the installation path is selected. the default path is long. you are advised to change the installation path to "C: \ apache, until it is completed.

After the installation is complete, apache is automatically started to test whether apache is successfully started. Enter http: // localhost/or http: // 127.0.0.1 in the address bar of the browser. if "It works. ", congratulations, apache has been successfully installed. at the same time, there is a green apache server running icon in the taskbar in the lower right corner of the computer.

Apache also has a configuration file: httpd: conf, which needs to be configured for php to run. Location: C:/apache/conf directory. Open httpd: conf:
1) search for "DocumentRoot". here is the Directory of the specified home page. The default value is "C:/Apache/htdocs". you can use the default directory or define it yourself, for example, "D:/PHP ". Note: Do not add "/" at the end of the Directory.
2. check for the latest directoryindex.html. this is the name of the first page of the document. you can add index. php to the end of index.html. Leave a space between each type.
3) search

Options FollowSymLinks
AllowOverride None
Order deny, allow
Deny from all

To:

Options FollowSymLinks
AllowOverride None
Order deny, allow
Allow from all

If You do not change this page, You may encounter an error such as You don't have permission to access/on this server. especially after You change the default homepage path.

Note: Restart the apache server every time you modify the httpd: conf file. In addition, if the iis server is also running on your win32 system, you must stop the iis server and then start apache. Otherwise, the apache server cannot be started.

Php installation and configuration

First download the windows version from the official php website http://www.php.net/downloads.php, there are two versions: PHP 5.2.6 zip package and PHP 5.2.6 installer, the latest version is 5.2.6, easy to use is 5.2.5 version. PHP 5.2.6 installer is an automatic installation method. although it is relatively automated, it is limited in many aspects. Therefore, this method is not recommended for installation, the following describes how to manually install a zip package in PHP 5.2.6.

1) decompress the PHP zip package to a directory. we recommend "C:/PHP ".
2) convert PHP under the PHP Directory (C:/php. rename the ini-dist file to php. ini, PHP configuration file is it, modify the following places, after modifying the php. copy the ini file to the C: \ WINDOWS \ directory:
Extension_dir = "C: \ php \ ext", pointing to the path where the "php _ *. dll" file is placed in the php folder. The paths of PHP4 and PHP5 are different here.
Doc_root = "D: \ PHP", pointing to the home page set in apache;
Default_charset = "gb2312", modify the default character set. here, if there is a semicolon ";" in front, remove this semicolon;
Change register_globals = Off to register_globals = On to make the passed global variable valid;
Extension = php_dba.dll if there is a semicolon in front, cancel the semicolon, the same as below;
Extension = php_dbase.dll
Extension = php_gd2.dll GD library is used for drawing verification codes;
Extension = php_mysql.dll is used to connect to the MYSQL database;
3) copy the php5ts. dll file under the PHP directory to the C: \ WINDOWS \ system32 directory.
4) modify the httpd. conf file of Apache. Add the following two lines at the end of the file to install PHP in the module mode to enter Apache:
LoadModule php5_module c:/php/php5apache2_2.dll
AddType application/x-httpd-php. php

Note: the directory path of the first line must be updated to the apache dynamic link library of the current version. for example, if apache2.2.8 and php5.2.5 are used here, the file must be php5apache2_2.dll, not php5apache. dll, php5apache2. dll. The suffix of the second php step.
In php4, you need to add a line of AddType mod_php4.c. in php5, you do not need such a line of AddType mod_php5.c. php5 has been integrated; otherwise, apache cannot be started.

The above completes the configuration process of apache and php, and restarts apache. Create the index. php file in the default directory "C:/Apache/htdocs" on the server and write the following code:
Phpinfo ();
?>
Enter http: // 127.0.0.1 or http: // localhost in the address bar of the browser, and you will see the php version information. So far, php and apache have been successfully installed.

Here is the details: httpd, the configuration file of apache. the directory delimiter in conf is "/", while the PHP configuration file is php. the directory in ini must be a backslash "\". Don't confuse it.

MYSQL installation is simple. Go to the official website http://dev.mysql.com/downloads/mysql/5.0.html to download mysql from the Windows platform. select Windows ZIP/Setup. EXE (x86) to the latest version 5.0.67 and download it. Install mysql directly. after installation, you can enter the configuration wizard to set the mysql database password. Everything is OK.

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.