Www.apache.com up and down an HTTP server, and then download the PHP package to www.php.com, which will act as a module for the Apache server. Now the latest version of Apache HTTP server is 2.2.3. That's what I started downloading. The installation process is simple. Then install the PHP package, the latest version is 5.1.6, also very simple, unzip to any place, such as c:php, and then the folder path c:php added to the environment variable path. Configure PHP: It is OK to copy the php.ini-recommended in the PHP folder to php.ini. Change the Apache server to add the PHP module: In the conf/httpd.conf file, add:
- # for PHP 5 does something like this:
- LoadModule php5_module "C:/php/php5apache2.dll" <---- Line 117
- AddType application/x-httpd-php. php
- # Configure the path to PHP.ini
- Phpinidir "c:/php"
Then restart the Apache server, the result error:
- Httpd.exe:Syntax error on line 117 of C:/apache/conf/httpd.conf:cannot load C:
- /php/php5apache2.dll to server:the specified module could not be found.
- < ESC >
It took me two hours to ... Cry... Workaround: The next 2.0.59 Apache server is OK, the previous error is caused by the version problem. To check if it is installed, save the following code as hello.php, and place it in Htdocs under the home folder of the Apache server. Run the server, enter it in the browser : localhost/hello.php view.
- Php
- $ Time Time = time ();
- $ Thetime Date("L, JS F Y G:ia", $time);
- echo "Hello world! The time is currently ". $thetime. ".";
- ?>
Alas, the next day encountered a new problem, unable to connect the database, prompt error:
The reason is that PHP5 has canceled the bundled MySQL client, and we need to change the configuration file ourselves. Cancel the extension Php_mysql.dll comment, and then set the Extension_dir to OK. My configuration is fine, and the DDL files are in the right place. But the problem is still, finally had to change the software version again, I replaced PHP with 4.4.4. Since 4.4.4 is automatically configured for MySQL, you do not need to change the php.ini, just edit the Apache configuration file:
- #LoadModule php5_module "C:/php/php5apache2.dll"
- LoadModule php4_module "C:/php/sapi/php4apache2.dll"
You can use this PHP server to install test code to test:
- Php
- Echo Phpinfo ();
- $ Link mysql_connect(' localhost ', ' root ', ' 123456 ');
- if (! $link) {
- Die (' Could not connect: '. Mysql_error ());
- }
- Echo ' Connected successfully ';
- Mysql_close ($link);
- ?>
It is gratifying to find the Mysql_connect method this time, but there are new errors:
I almost want to give up here! Think of the importance of PHP, and finally bite the teeth insist to survive over. This error is because the PHP4 MySQL client program password algorithm and the new MySQL server is incompatible, for the PHP4 solution seems to have only one, in MySQL inside the following command to execute:
- MySQL > Passwordold_password(' newpwd ')
- - > Host' some_host 'User' some_ User ';
- MySQL > FLUSH privileges;
http://www.bkjia.com/PHPjc/446521.html www.bkjia.com true http://www.bkjia.com/PHPjc/446521.html techarticle We all know the powerful features of PHP, we worry about the installation of PHP server to make a detailed introduction, and everyone to share, we will follow the following steps to operate together, come ...