How to configure PHP environment in windowsxp _php Tutorial

Source: Internet
Author: User
Tags echo date php and mysql
Download the php5:php tutorial. Net/distributions/php-5.2.6-win32.zip "target=" _blank ">http://cn2.php.net/distributions/ Php-5.2.6-win32.zip
Download apache:http://down.chinaz.com/soft/18000.htm


I. Installation and commissioning of PHP
Since PHP is a zip file (not the install version), the installation is relatively simple, decompression on the line. Rename the extracted php5.2.1-win32 to PHP5. and copy it to the C drive directory. That is, the installation path is C:PHP5
1 Locate the Php.ini-dist or php.ini.recommended file in the PHP directory and rename it to PHP.ini
and copy to the Windows directory of the system disk (take c:windows as an example).
2 Copy the Php5ts.dll,libmysql Tutorial. dll under the PHP directory to the directory c:windowssystem32.
3 Copy the Php_gd2.dll,php_mysql.dll,php_mbstring.dll file under the Php5ext directory to C:windowssystem32
If not loaded Php_gd2.dll PHP will not be able to process the image. No load Php_mysql.dll PHP will not support MySQL library
Php_mbstring.dll supports wide characters when using phpMyAdmin in the back.
4 Open C:windowsphp.ini file (associated to MySQL)
Set extension path
Find Extension_dir has such a line Extension_dir = "./"
Change this line to
Extension_dir = "C:php5ext"
Where C:PHP5 is your path to install PHP. The path is incorrect and the DLL cannot be loaded
(Note: some PHP versions are; extension_dir = "./" To remove the preceding semicolon)
Find extension
Extension=php_mbstring.dll
Extension=php_gd2.dll
Extension=php_mysql.dl
Remove the semicolon from the preceding 3 items so that the Apache can load the DLLs when it is started.
Of course, we also copied these DLLs to System32.
PHP5 Time difference problem
Time difference Eight hours
Why is it? The PHP5 series has a new time zone setting, which defaults to GMT, which is 8 hours from the East 8 district in China.
Find Date.timezone have this line
;d Ate.timezone =
To remove, change, or convert to
Date.timezone = PRC
Two. Apache's commissioning and integration
1. Modify the Web site root directory
Find DocumentRoot have this line
DocumentRoot "C:/Program Files/apache group/apache2/htdocs"
This is the root of your site, you can modify, you can also use the default. If you change it, change the following, or you may get a 403 error
Find this should is changed to whatever you set DocumentRoot to
There are two lines below it

Change the above two C:/Program Files/apache Group/apache2/htdocs to the directory you want.
2. Let Apache support *.php (web)
Find DirectoryIndex index.html Index.html.var
Modified into
DirectoryIndex index.html Index.html.var index.php
This allows the index.php to act as a default page.
Modular installation of PHP in 3.Apache
Find # LoadModule Foo_module modules/mod_foo.so
Add a row after this line
LoadModule Php5_module C:/php5/php5apache2.dll//NOTE: where c:/php5/ Php5apache2.dll is the appropriate path for you to install PHP. Don't confuse Php5apache2.dll with Php5apache.dll. Php5apache.dll is only available for Apache version 1. The Php5apache2.dll in the PHP5 compression package is only available for apache2.0.* version, and if it is 2.2.* or above, it may appear "cannot load C:/php/php5apache2.dll into server:the Specified module could not being found. " Or: "The requested operation has failed"
4. Find AddType application/x-gzip. gz. tgz
Add a row after this line
AddType application/x-httpd-php. PHP (Remember: There is a space in front of it!!!) )
So Apache can explain PHP files.
5. Testing
Create a phpinfo.php file in the root directory of the Web site

Phpinfo ();
?>

Open in Browser
http://localhost/phpinfo.php
5. Testing the Association of PHP and MySQL database tutorials
Create a test.php file in the root directory of the Web site

$link =mysql_connect ("localhost", "root", "12345"); 12345 change to your MySQL password
if (! $link) echo "Failed!";
else echo "Success!";
Mysql_close ();
?>

Open http://localhost/test.php in Browser
If the output is successful, it's done.

http://www.bkjia.com/PHPjc/629840.html www.bkjia.com true http://www.bkjia.com/PHPjc/629840.html techarticle Download the php5:php tutorial. Net/distributions/php-5.2.6-win32.zip "target=" _blank "> http://cn2.php.net/distributions/ Php-5.2.6-win32.zip Download Apache:http://down.chinaz.com/soft/18000.h ...

  • 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.