PHP-related operating environment _php

Source: Internet
Author: User
Keywords Environment operation correlation c extension setting
Software download
1. Download Apache http://www.apache.org for HTTP Server service, download Apache_1.3.29.tar or Apache_2.0.49-win32-x86-no_ssl

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

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


Installation Instructions

First, install Apache

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

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

(1), Port: Modify port:80 to 8080, avoid conflicts with IIS (that is, users who install IIS need to set this);

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

(3), DirectoryIndex index.html, for the browser parsing the order of the file suffix, 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, the following settings should be added to the last part of httpd.conf:

The front is suitable for the PHP3, the latter is suitable for the PHP4, but one must match with the path which you installs and must not have the space in front of each sentence

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, installation PHP4

1, the extracted php-4.3.6-installer files in the C:\php folder

2. Configure PHP

(1), and PHP with the distribution of the package has a PHP main configuration file Php.ini-dist
Copy it to your Windows system directory (Windows 9x \ \ \ \ Windows NT \winnt directory),
and renamed to PHP.ini. This file needs to be modified appropriately, the most important thing is to add some of the modules that may be used, such as to join MySQL support.

(2), modify; Extension=php_msql.dll remove the ";" number from the front 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 comment character of the line, which is the preceding semicolon ";", is removed to make the line work 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 the DLL file of the database you want to use a line before the comment, that is, the preceding semicolon ";" to remove.
For example: I need MySQL support, just remove; Extension=php_msql.dll the semicolon in front of it.
If you do not list the DLL file you use to the 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
To set up an SMTP server for SMTP, preferably your local SMTP server, I have a 21CN SMTP server as an example, and then,
Fill in your e-mail address at Sendmail_from, for example, you can change it:
SMTP = smtp.21cn.com
Sendmail_from = pert@21cn.com

(7), the following items for the [MySQL] column 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, and the function syntax is as follows:
Mysql_connect (string [hostname] [:p ort], string [username], string [password]);
Here we set the default port for the MySQL database connection to 3306, and 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 empty, that is, there is no password.
If the MySQL database to be connected is located on a different port, we must append a colon and port number to 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, the "C:\apache2\htdocs" in this example (for Apache installation and setup is described in more 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, the "C:\Inetpub\wwwroot" in this example (for the installation and setup of PWS is described in more detail in the next section). Of course
The most convenient thing is that you can use nothing, and still leave it empty.

(9), a less critical 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 dynamic link library problem
The configuration of the environment and the operation of the program need to use the dynamic link library, but also important
(1), copy C:\php\php4ts.dll to Winnt\system
(2), will c:\php\dlls\libeay32.dll LibmySQL.dll mSQL.dll Yaz.dll Copy to Winnt\system
(3), copy C:\php\extensions\php_msql.dll to Winnt\system
(4), copy C:\php\extensions\php_msql.dll to c:\php
(5), in short, as long as the need to use the dynamic link library copy to Winnt\system just fine

At this point, PHP.ini has basically all the edits completed, php.ini Other items you can also be set according to different needs, here no longer repeat.
Now all you have to do is put the compiled php.ini under your Windows system directory, namely: winnt\

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

(7), now to test, write a php file with Notepad, contains only one sentence: Save it as 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 in front of you, everything is OK.


Third, install MySQL
1. Copy all the files under the extracted Mysql-4.1.1a-alpha to the C:\mysql\ folder

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


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

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

(3), add to the website


Can

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

Unzip the phplib and copy to the C:\php\phplib folder,
and set 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

VI. MySQL Foreground management environment
Use Mysqlfront copy directly to C + +

Seven, easy to set up
The existing set of httpd.conf and php.ini, the installation path is all H disk, only need to modify the corresponding path you installed.

Eight, the installation and configuration of Gdlib
In order to be able to implement the function of drawing in PHP program, we must join the Gdlib library
Unzip the gd-2.0.26.zip into the C:\php\extensions\gd2 folder
and set PHP.ini
Extension_dir = C:\php\extensions
Extension=php_gd2.dll in front of the ";" removed, indicating that the Php_gd2.dll dynamic link is valid,

OK, now restart Apache and start the service
Test file: drawpie.php
  • Related Article

    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.