After installing apache2 + php5, I want to install mysql5 again. After installing mysql5 with the source code, I found that I wanted to add new extensions for php in Linux. unlike in windows, I just needed to remove the semicolon comment ~ I found a lot of information on the Internet and finally got it done. close up the diary to congratulate me. Step 1: Go to the php source code directory: # cd/usr/ChenShao/php-5.3.1/2.
After installing apache2 + php5, I want to install mysql5 again.
After installing mysql5 with the source code, I found that I wanted to add new extensions for php in Linux. unlike in windows, I just needed to remove the semicolon comment ~
I found a lot of information on the Internet and finally got it done. close up the diary to congratulate me.
To add an extension, follow these steps:
1, enter the php source code directory: # cd/usr/ChenShao/php-5.3.1/
2. go to the mysql extension source code directory to be added: # cd ext/mysql/
2. call phpize in compiled php: #/usr/local/php5/bin/phpize
3. then, configure: #./configure -- with-php-config =/usr/local/php5/bin/php-config -- with-mysql =/usr/local/mysql
(/Usr/local/mysql is the installation directory of mysql)
4. make & make install
5. after compilation, mysql is automatically loaded. so to the default php extension directory (phpinfo can be viewed, my/usr/local/php5/lib/php/extensions/no-debug-zts-20090626), and then modify php. ini, remove the semicolon before extension = php_mysql.so.
Note that the generated module is namedMysql. soIn php. iniPhp_mysql.soThe names are inconsistent. you must change mysql. so to php_mysql.so. remember to remember ~!
6. restart apache: # service httpd restart
Note: If step 1 passes, but the error is reported in step 2, it is likely that the source code is faulty. I downloaded a new copy from php.net and then compiled it before it passes.
The connection is successful in php.
!