PHP's related operating environment

Source: Internet
Author: User
Tags copy iis ini mysql php file mysql database port number root directory
Software downloads
1, download the Apache http://www.apache.org to find HTTP Server service, download Apache_1.3.29.tar or Apache_2.0.49-win32-x86-no_ssl

2, download the PHP http://www.php.net to find Php-4.3.6-installer

3, download the MySQL http://www.mysql.com to find Mysql-4.1.1a-alpha-win


Installation Instructions

First, install Apache

1, the installation of Apache to the C:\ root directory, will automatically generate Apache2 folder that C:\apache2

2, the configuration c:\apache2\conf\httpd.conf file,

(1), Port: Modify port:80 to 8080, to avoid conflicts with the use of IIS (that is, users with IIS installed need to set this);

(2), DocumentRoot "C:\Apache2\htdocs", which has similar functions to the wwwroot of IIS

(3), DirectoryIndex index.html, the order in which the file suffixes are parsed by the browser, can be added later:
index.html index.htm index.php3 index.php index.phtml index.xml default.php default.htm default.html default.xml etc.
(separated by spaces)

(4), in order to be able to use PHP, you should add the following settings in the last part of httpd.conf:

The front of the suitable PHP3, the back of the suitable PHP4, but there is a must and you install the path and the front of each sentence must not be a space

scriptalias/php3/"c:/php3/"
AddType application/x-httpd-php3. php3. php. phtml. htm. html. xml
Action application/x-httpd-php3 "/php3/php.exe"

scriptalias/php/"c:/php/"
AddType application/x-httpd-php. php. phtml. htm. html. xml
Action application/x-httpd-php "/php/php.exe"

(5), start Apache and start service


Second, install PHP4

1, the decompression of the Php-4.3.6-installer within the document all made to the C:\php folder

2. Configure PHP

(1) There is a PHP main configuration file in the package that is distributed with PHP php.ini-dist
Copy it to your Windows system directory (Windows 9x or Windows NT \WINNT directory),
and renamed for PHP.ini. You need to make appropriate changes to this file, the most important thing is to add a number of possible modules, such as the support of MySQL to join.

(2), modify, Extension=php_msql.dll remove the front ";" number to make it effective

(3), modify Extension_dir =./Change to your PHP3 installation directory, for example: Extension_dir = c:\php

(4), upload_tmp_dir the line's annotation, that is, the preceding semicolon ";", so that the line works in the php.ini document.

(5), what database support do you need? Find here:
; Windows Extensions
; Extension=php3_mysql.dll
; Extension=php3_calendar.dll
; Extension=php3_dbase.dll
; Extension=php3_gd.dll
; Extension=php3_dbm.dll
; Extension=php3_mssql.dll
; Extension=php3_zlib.dll
; Extension=php3_filepro.dll
; Extension=php3_imap4r1.dll
; Extension=php3_ldap.dll
; Extension=php3_crypt.dll
; Extension=php3_msql2.dll
; Extension=php3_odbc.dll
Then, according to your own needs, put your database DLL file in front of a line of the annotation character, that is, the preceding semicolon ";"
For example: I need the support of MySQL, just remove; Extension=php_msql.dll before the semicolon.
If you don't have a DLL file for your database, it doesn't matter, you can add it yourself.

(6), if you want to use PHP to send mail, please find here:
SMTP = localhost
Sendmail_from = me@localhost.com
Set SMTP server for SMTP, preferably your local SMTP server, where I use the 21CN SMTP server as an example, and then,
Fill in your e-mail address at the Sendmail_from, for example, you can change to this:
SMTP = smtp.21cn.com
Sendmail_from = pert@21cn.com

(7), the [MySQL] column of the following items are set as follows:
Mysql.default_port = 3306
Mysql.default_host = localhost
Mysql.default_user = root
The mysql_connect () function is used to establish a connection to the MySQL database on the specified host, as shown in the function syntax:
Mysql_connect (string [hostname] [:p ort], string [username], string [password]);
Here we have set the default port for the MySQL database connection is 3306, the host that establishes the connection is the local host localhost,
The user is root, and the parameter password is not set, the password parameter is blank, that is, there is no password.
If the MySQL database to be connected is located on a different port, we must add a colon and a port number after the host name.
as follows: $db = mysql_connect (Localhost:3306,root,password);

(8) If you are using the Web server is Omni httpd, please skip this step;
If you are using Apache as your Web server, you can set Doc_root as the root directory of the Apache server,
For example, in this example, "C:\apache2\htdocs" (the installation and setup of Apache is described in detail in the next section);
If you are using PWS as your Web server, you can set the Doc_root directory to point to the PWS server's default root directory,
For example, in this example, "C:\Inetpub\wwwroot" (for the installation and setup of PWS is described in detail in the next section). Of course
The most convenient thing is that you can not set anything, still put it empty.

(9), a very important setting:
If you are using PWS as your Web server, you can also set Browscap.ini,
Browscap = Extra/browscap.ini change to Browscap = C:\windows\system\inetsrv\browscap.ini.

3, about the problem of dynamic link library
The configuration of the environment and the operation of the program need to use a dynamic link library, and is critical
(1), will c:\php\php4ts.dll copy to Winnt\system
(2), will c:\php\dlls\libeay32.dll LibmySQL.dll mSQL.dll Yaz.dll Copy to Winnt\system
(3), will c:\php\extensions\php_msql.dll copy to Winnt\system
(4), will c:\php\extensions\php_msql.dll copy to c:\php
(5), in short, as long as the need to use the dynamic link library copy to Winnt\system good

At this point, php.ini has been basically all edited, php.ini other items you can also set according to different needs, here no longer repeat.
Now all you have to do is put the php.ini into your Windows system directory, which is: winnt\

(6), OK, now restart Apache, and start the service

(7), now for testing, with Notepad to write a php file, contains only one sentence: <?phpinfo ();? > Save it as a test.php format,
and copy to C:\apache2\htdocs, now open the browser, enter: http://localhost/test.php:8080
When you see the beautiful php Version 4.3.6 page, everything is OK.


Third, the installation of MySQL
1, will extract all the files under the Mysql-4.1.1a-alpha copy to the C:\mysql\ folder

2, run C:\mysql\bin\winmysqladmin.exe, just OK


Iv. settings for support issues in Chinese
(1), configure c:\apache2\conf\httpd.conf
Modified: Adddefaultcharset gb2312
Restart Apache

(2), configure C:\winnt\my.ini
Find: #language =c:\mysql\share\charsets, remove #, and change to Language=c:\mysql\share\charsets:

(3), add in the Web page
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<meta content= "text/html; charset=gb2312 "http-equiv=content-type>
Can

V. Installation and configuration of Phplib Library
In order to separate the program from the artwork we need the class library and template, so we must join the Phplib library,

After you extract the Phplib, copy to the C:\php\phplib folder,
and set the php.ini
; Windows: "\path1;\path2"
include_path = C:\php\phplib\php\ and save

OK, now restart Apache and start the service
Test file: myt.php

Six, MySQL front desk management environment
You can use Mysqlfront copy directly to C:\

Vii. Simple Settings
The existing set of httpd.conf and php.ini, installation path is all H disk, only need to modify the appropriate path for your installation.

Viii. installation and configuration of Gdlib
In order to be able to achieve the function of drawing in the PHP program, we must join the Gdlib library
Unzip the Gd-2.0.26.zip to the C:\php\extensions\gd2 folder
and set the php.ini
Extension_dir = C:\php\extensions
Extension=php_gd2.dll front of the ";" Remove, means php_gd2.dll This dynamic link is valid,

OK, now restart Apache and start the service
Test file: drawpie.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.