Home  >  Article  >  Backend Development  >  Learn centos to install php mysql extension

Learn centos to install php mysql extension

WBOY
WBOYOriginal
2016-07-25 08:56:361077browse
  1. # cd /usr/ChenShao/php-5.3.1/
Copy the code

2. Enter the mysql extension source code directory to be added:

  1. # cd ext/mysql/
Copy the code

2. Call phpize in the compiled php:

  1. # /usr/local/php5/bin/phpize
Copy the code

3. Then configure:

  1. # ./configure --with-php-config=/usr/local/php5/bin/php-config --with-mysql=/usr/local/mysql
  2. (/usr/local/mysql For the installation directory of mysql)
Copy the code

4,

  1. make && make install
Copy the code

5. After compilation, mysql.so is automatically placed in the default php extension directory (phpinfo can be viewed, here 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. Note: 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:

  1. # service httpd restart
Copy code

Note: If step 3 passes but an error is reported in step 4, it may be a problem with the source code. You can download a new file from php.net and recompile it.



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn