First, the environment
Lamp is the source of installation, PHP installation is not configured Pdo_mysql and Mysqli,pdo is php5 default band.
PHP5 The source code are in, just need to php5 module function expansion on it.
PHP Source directory:/usr/local/src/php-5.2.10
PHP installation directory:/usr/local/php/
PHP Source configuration file:/usr/local/php/bin/php-config
PHP program configuration file:/usr/local/php/etc/php.ini
Ii. compilation and installation of modules
[[Email protected] ~] cd/usr/local/src/php-5.2.Ten/ext/Pdo[[email protected] PDO]/usr/local/php/bin/Phpize[[email protected] PDO]./configure–with-php-config=/usr/local/php/bin/php-Config[[email protected] PDO] Make[[email protected] PDO] MakeTest[[email protected] PDO] Make Install[[Email protected]~] cd/usr/local/src/php-5.2.Ten/ext/Pdo_mysql[[email protected] pdo_mysql]/usr/local/php/bin/Phpize[[email protected] pdo_mysql]./configure–with-php-config=/usr/local/php/bin/php-config–with-pdo-MySQL=/usr/local/Mysql[[email protected] pdo_mysql] Make[[email protected] pdo_mysql] MakeTest[[email protected] pdo_mysql] Make Install[[Email protected]~] cd/usr/local/src/php-5.2.Ten/ext/Mysqli[[email protected] mysqli]/usr/local/php/bin/Phpize[[email protected] mysqli]./configure–with-php-config=/usr/local/php/bin/php-config–with-mysqli=/usr/local/mysql/bin/Mysql_config[[email protected] mysqli] Make[[email protected] mysqli] MakeTest[[email protected] mysqli] Make Install
Note:
Note the location of the directory must be correct at the time of installation, or the module cannot be loaded.
The command/usr/local/php/bin/phpize must be executed in the installed directory.
After installation, three so modules are generated:
/usr/local/php/lib/php/extensions/no-debug-zts-20060613/pdo.so/usr/local/php/lib/php/ extensions/no-debug-zts-20060613/pdo_mysql.so/usr/local/php/lib/php/extensions/no-debug-zts- 20060613/mysqli.so
Third, the configuration of PHP configuration files
To change the php.ini configuration, add modules:
vi /usr/local/php/etc/php.iniextension=/usr/local/php/lib/php/extensions/no-debug-zts- 20060613/pdo.soextension=/usr/local/php/lib/php/extensions/no-debug-zts-20060613/ Pdo_mysql.soextension=/usr/local/php/lib/php/extensions/no-debug-zts-20060613/mysqli.so
Service Restart:
Service mysqld Restartservice apached restart
Iv. Environmental Testing:
1, PHP5 Environment view (build PHP function):
VI phpinfo.php<? phpphpinfo ();? >
Visit the phpinfo.php page to see if the module extension does not exist:
http://127.0.0.1/phpinfo.php
Note:
If the function cannot be used, change the use permissions of the configuration open function.
vi /usr/local/php/etc/= Phpinfo,passthru,.....
Delete Phpinfo This function can be saved.
[[Email protected] ~] Service apached Restart
2, mysqli Connection test (establish Web test connection).
VI= new mysqli ("localhost", "dbusername", "Dbpassword", "dbname"); /* */If%%s\n ", $mysqli-host_info); /* */$mysqliclose ();? >
To access the established PHP test page:
http://127.0.0.1/mysqlidb.php
PHP5 module PDO, Pdo_mysql, mysqli add-on