Install MySQL extension of PHP in centos

Source: Internet
Author: User

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. Go to PhPSource codeDirectory: # 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 step 2 reports an error, it is likely that the sourceCodeProblem, I downloaded a new copy from php.net and then compiled it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.