Author: zccst
The environment created here is: apache2.2 + mysql5.1 + php5.2
I. Installation
1. Install apache2.2
Reference: blog.csdn.net/zccst/article/details/4435381
Including self-testing.
2. Install mysql5.1
Reference: http://blog.csdn.net/zccst/article/details/4487581
Including self-testing.
3. Install php5.2 (specify the Apache and MySQL paths during configure to associate them)
Tar
CD
./Configure -- prefix =/opt/PHP -- With-mysql =/opt/MySQL -- with-apxs2 =/opt/Apache/bin/apxs
Make
Make Test
Make install
Including self-testing.
2. modify the configuration file associated with the three
1. Associate Apache with PHP.
Modify the Apache configuration file Vim/opt/Apache/CONF/httpd. conf.
Loadmodule php5_module modules/libphp5.so
Addtype application/X-httpd-PHP. php
Directoryindex index. php index.html index.htm
Restart: CD/opt/Apache/bin./apachectl restart
Test: phpinfo. php
phpinfo();
2. test whether the database connection is successful.
Nothing to change
Test: mysql. php
$con = mysql_connect("localhost","root","123456");if (!$con){ die('Could not connect: ' . mysql_error());}else{ echo "connect ok!";}// some codemysql_close($con);
Iii. Support for soap in PHP
Go to the source code directory
CD php-5.2.13/EXT/soap
/Usr/local/PHP/bin/phpize # Run phpize to generate configure # phpize in the installed PHP Folder/bin. (Currently under the folder after the source code is pressurized)
./Configure -- With-PHP-Config =/usr/local/PHP/bin/PHP-config -- enable-soap
Make; make install
The compiled soap. So file is saved in the/usr/local/PHP/lib/PHP/extensions/no-debug-non-zts-20050922 directory.
Modify the php. ini file
Find extension_dir = "./" in/usr/local/PHP/etc/PHP. ini "./"
Change to extension_dir = "/usr/local/PHP/lib/PHP/extensions/no-debug-non-zts-20050922 /"
Add the following lines:
Extension = "Soap. So"
Save and exit and restart Apache. Then we have loaded the soap extension module.
Use/usr/local/PHP/bin/PHP-M | grep soap to check whether soap. So exists.
Note: the most important thing is to find the location where the php. INI is read.
FindConfiguration file (PHP. INI) pathThis line
Value on the right/Usr/local/webserver/PHP/etcIs the directory where the php. ini file is located.
After the last modification, remember to restart the relevant program to take effect.
In addition, the XX. dll file is annotated in windows.
4. PHP supports pdo_mysql
1. confirm that the PHP environment is configured, find the pdo_mysql extension directory of the PHP installation package, assuming that your installation package is under/lamp/php-5.2.6.
[Root @ localhost/] # cd/lamp/php-5.2.6/EXT/pdo_mysql
[Root @ localhost pdo_mysql] #
[Root @ localhost pdo_mysql] # pwd
/Lamp/php-5.2.6/EXT/pdo_mysql
[Root @ localhost pdo_mysql] #
2. Assume that your PHP is installed in/usr/local/PHP. Run/usr/local/PHP/bin/phpize and run the following command:
[Root @ localhost pdo_mysql] #/usr/local/PhP5/bin/phpize
3. compile .. /Configure -- With-PHP-Config =/usr/local/PHP/bin/PHP-config -- With-PDO-mysql =/usr/local/MySQL (assume that your MySQL is installed in/usr/local/MySQL)
[Root @ localhost pdo_mysql] #. /configure -- With-PHP-Config =/usr/local/PHP/bin/PHP-config -- With-PDO-mysql =/usr/local/MySQL
4. Compile and install the SDK. Make, make install
[Root @ localhost pdo_mysql] # Make & make install;
5. after compilation, the/usr/local/PHP/lib/PHP/extensions will have an additional no-debug-non-zts-20060613 folder, which generates a pdo_mysql.so, modify PHP. INI, add the extension statement
Extension = "/usr/local/PHP/lib/PHP/extensions/no-debug-non-zts-20060613 /";
Extension = pdo_mysql.so
6. Restart Apache and you will be able to see the support for pdo_mysql extension in the phpinfo information.
[Root @ localhost pdo_mysql] #/usr/local/apache2/bin/apachectl restart