Step for adding php extension pdo_mysql to centos, centospdo_mysql

Source: Internet
Author: User

Step for adding php extension pdo_mysql to centos, centospdo_mysql

This article uses CentOS as an example. The Red Hat series Linux methods should all be like this. The following describes the steps in detail. What are the content seriously despised here ?? Long Yunxian brain Xiaoying said to crack the PDO compilation and installation articles.

1. Go to the pdo extension directory of the PHP Software Package (Note: it is not the PHP installation directory)
If not downloaded:

1. Download The wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz File
2. decompress the file
Tar zxvf PDO_MYSQL-1.0.2.tgz
3. Configure and compile files
Go to the PHP source code package and enter the cd/root/php source code file/ext/pdo_mysql/PDO_MYSQL
Run the phpize command

The Code is as follows:
/Usr/local/php/bin/phpize

Note:/usr/local/php is my php installation directory.

After the phpize command is executed, configure appears in the pdo_mysql directory.

Execute Configuration

The Code is as follows:
./Configure -- with-php-config =/usr/local/php/bin/php-config -- with-pdo-mysql =/usr/local/mysql/

Parameter description:

-- Wi (www.111cn.net) th-php-config =/usr/local/php/bin/php-config specifies the configuration during PHP installation
-- With-pdo-mysql =/usr/local/mysql/Specify the installation directory of the MySQL database
Compile and install

The Code is as follows:
Make & make install

After the compilation is complete, check whether the information similar to that shown in slices appears.

The Code is as follows:
/Usr/local/php/lib/php/extensions/no-debug-non-zts-20090626

(Note: The directory names may be different in different time periods)

After compilation and installation are complete, the generated pdo_mysql.so file is placed in this directory.

2. Modify the php. ini file

Use vi to open the php. ini file on your machine, add a piece of code "extension =/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/pdo_mysql.so", load the pdo_mysql.so File

3. View phpinfo ()

Restart the Apache server. Use the phpinfo () function to view the php installation information, as shown in. The PDO extension is successfully installed.
From: http://www.111cn.net/sys/CentOS/65110.htm


Php pdo extension Problems

Search for php. ini and find the following line of text.
Windows Extensions
The extension modules supported by the main task are removed with semicolons, and the following line of code is appended to the end.
Extension = php_pdo.dll
This is an extension shared by all PDO drivers and must be available. Then, you can see what database you are using. If MySQL is used, add the following line.
Extension = php_pdo_mysql.dll
Save php. ini and restart the Apache server. You can.
 
In linux, how does one add the php_pdo_mysql module without re-installing apache?

I. php5 compilation parameters are as follows:
. /Configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-mysql =/usr/local/mysql -- with-mysqli = /usr/local/mysql/bin/mysql_config -- with-config-file-path =/usr/local/php/etc -- with-iconv-dir =/usr/--- freetype-dir -- with-jpeg-dir -- with-png-dir -- with-zlib -- with-libxml-dir =/usr/local/libxml2 -- enable-xml -- disable-rpath -- enable-discard-path -- enable-safe-mode -- enable-bcmath -- enable-shmop -- enable-sysvsem -- enable-inline-optimization -- with-curl -- with-curlwrappers -- enable -mbregex -- enable-mbstring -- with-mcrypt -- with-gd -- enable-gd-native-ttf -- with-openssl -- with-mhash -- enable-sockets -- with-xmlrpc -- enable -zip -- enable-soap -- enable-exif -- enable-calendar -- enable-magic-quotes -- enable-wddx -- enable-dba -- with-qdbm & make install
2. Use phpize to load pdo_mysql,
Wget pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
Tar xzvf PDO_MYSQL-1.0.2.tgz
Cd PDO_MYSQL-1.0.2
/Usr/local/php/bin/phpize
Processing ing:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
./Configure-with-php-config =/usr/local/php/bin/php-config
Make
Make install
3. Edit the/usr/local/etc/php. ini file, add extension = pdo. so, and restart apache.
4. Verify php and enter the php-m command, which contains the full text of pdo_mysq.so...>

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.