Apache2 and PHP5 for winxp simple configuration Tips _win Server

Source: Internet
Author: User
Tags echo date install php php and php and mysql phpinfo
I. Installation and commissioning of PHP
Because PHP is a zip file (not install version), the installation is simpler, decompression on the line. Rename the extracted php5.2.1-win32 to PHP5. and copy it to the C disk 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 it to the Windows directory of the system disk (for example, C:\Windows).
2 then copy the Php5ts.dll,libmysql.dll in the PHP directory to the directory C:\Windows\System32.
3 Copy the Php_gd2.dll,php_mysql.dll,php_mbstring.dll file under the Php5\ext directory to C:\Windows\System32
If you do not load Php_gd2.dll PHP will not be able to process the image. Not loaded Php_mysql.dll PHP will not support MySQL function library
Php_mbstring.dll supports wide characters when using phpMyAdmin later.
4 Open C:\windows\php.ini file (associated to MySQL)
Set extension path
Find Extension_dir have such a line of Extension_dir = "./"
Change this row to
Extension_dir = "C:\php5\ext"
Where C:\PHP5 is your path to installing PHP. Incorrect path will fail to load DLL
(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 before the top 3 items so that the Apache can load these DLLs when it starts
Of course, we've also copied these DLLs into the System32 before L
PHP5 jet lag problem
<?php echo Date ("y-m-d h:i:s");? > Time difference eight hours
Why, then? The PHP5 series has new time zone settings, the default is GMT, and China's East 8 area is exactly 8 hours
Find Date.timezone there's a line
;d Ate.timezone =
Remove, change
Date.timezone = PRC
Two. Apache Debugging and Integration
1. Modify the site root directory
Find DocumentRoot there's a line
DocumentRoot "C:/Program Files/apache group/apache2/htdocs"
This is the root of your site, you can modify it, or you can use the default. If you change, you have to modify the following, or you may have 403 errors
Find this should is changed to whatever your set DocumentRoot to
There are two lines under it
<directory "C:/Program files/apache Group/apache2/htdocs" >
Change the top two C:/Program Files/apache Group/apache2/htdocs to the directory you want.
2. Let Apache support *.php (webpage)
Find DirectoryIndex index.html Index.html.var
Modified into
DirectoryIndex index.html Index.html.var index.php
So index.php can act as the default page.
3.Apache Modular installation of PHP
Find # LoadModule Foo_module modules/mod_foo.so
Join a row after this row
LoadModule php5_module C:/php5/php5apache2.dll/Note: C:/php5/php5apache2.dll is the appropriate path for you to install PHP. Don't put Php5apache2.dll and php5 Apache.dll is confusing. Php5apache.dll only applies to Apache version 1. The Php5apache2.dll in the PHP5 compression package only applies to the apache2.0.* version, which may appear "Cannot load C:/php/php5apache2.dll into Server:the" If the above version is 2.2.*. Specified module could not is found. " Or: "The requested operation has failed"
4. Find AddType application/x-gzip. GZ tgz
Join a row after this row
AddType application/x-httpd-php. PHP (Remember: There is a space in front!!!) )
So Apache can explain PHP files.
5. Test
Create a phpinfo.php file under the site root

<?php
Phpinfo ();
?>

Open in Browser
http://localhost/phpinfo.php
5. Test the relationship between PHP and MySQL database
Create a test.php file under the site root

<?php
$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 succeeds, it's done.

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.