How to install php mysql extension in centos: first enter the php source code directory; then enter the mysql extension source code directory to be added; then call phpize in the compiled php; finally put "mysql.so" Just go to the default php extension directory.
Recommended: "PHP Video Tutorial" "centos Tutorial"
Centos installs the mysql extension of php
After installing apache2 php5, now I want to install mysql5 for fun.
After installing mysql5 from the source code, I found that I wanted to add a new extension to PHP on Linux. Unlike on Windows, just remove the semicolon comment~
I searched a lot of information on the Internet , finally got it done, close up the diary to express congratulations.
Basic steps for adding an extension:
1. Enter the php source code directory: # cd /usr/ChenShao/php-5.3.1/
2. Then enter the Added mysql extension source code directory: # cd ext/mysql/
2. Call phpize in the 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.so is automatically placed in the default php extension directory (phpinfo can view it, I is /usr/local/php5/lib/php/extensions/no-debug-zts-20090626), then modify php.ini and remove the semicolon in front of ;extension=php_mysql.so.
However, one thing to note is that the name of the generated module is mysql.so, which is inconsistent with the name of php_mysql.so in php.ini. Mysql.so must be renamed to php_mysql.so. Remember~!
6. Restart apache: # service httpd restart
Special note: If step 3 is passed, but an error is reported in step 4, it is likely to be a source code problem. I started from php After downloading a new copy of .net, I compiled it again and it passed.
The above is the detailed content of centos install php mysql extension. For more information, please follow other related articles on the PHP Chinese website!