Home  >  Article  >  Backend Development  >  How to compile and install PHP extension PDO under Linux (CentOS), centospdo_PHP tutorial

How to compile and install PHP extension PDO under Linux (CentOS), centospdo_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 08:54:221087browse

How to compile and install PHP extension PDO under Linux (CentOS), centospdo

This article describes how to compile and install PHP extension PDO under Linux (CentOS). Share it with everyone for your reference, the details are as follows:

Here is CentOS as an example. This should be the case for the Red Hat series of Linux methods. The steps are explained in detail below. I seriously despise the articles that are long-winded and talk about PDO compilation and installation.

1. Enter the PHP package pdo extension directory (note: not the PHP installation directory)

[root@gamejzy /]# cd /tmp/lamp/php-5.3.19/ext/pdo_mysql/

Note: My php package is under /tmp/lamp/php-5.3.19

Execute phpize command

[root@gamejzy pdo_mysql]# /usr/local/php/bin/phpize

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

After executing the phpize command, configure

will appear in the pdo_mysql directory

Execute configuration

Copy code The code is as follows: [root@gamejzy pdo_mysql]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql/

Parameter description:

--with-php-config=/usr/local/php/bin/php-config specifies the configuration when installing PHP
--with-pdo-mysql=/usr/local/mysql/ Specify the installation directory location of the MySQL database

Compile and install

[root@gamejzy pdo_mysql]# make && make install

After the compilation is completed, please pay attention to whether a message similar to the following picture appears

If a message appears indicating that the compilation and installation were successful, please pay close attention to the directories enclosed by the red lines (note: the directory names may be different in different time periods).

After compilation and installation are completed, the generated pdo_mysql.so file will be placed in this directory.

2. Modify the php.ini file

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

The effect is as follows:

Save and exit editing!

3. View phpinfo()

First restart the Apache server. Use the phpinfo() function to view the installation information of php. If the following figure appears, the PDO extension is successfully installed.

That’s it!

Readers who are interested in more PHP related content can check out the special topics of this site: "php curl usage summary", "PHP operation and operator usage summary", "PHP network programming skills summary", "PHP basic syntax introductory tutorial" ", "Summary of PHP office document operation skills (including word, excel, access, ppt)", "Summary of PHP date and time usage", "Introduction to PHP object-oriented programming tutorial", "Summary of PHP string (string) usage" , "Introduction Tutorial on PHP MySQL Database Operation" and "Summary of Common PHP Database Operation Skills"

I hope this article will be helpful to everyone in PHP programming.

Articles you may be interested in:

  • Installation and deployment of Redis under Linux
  • Installing Redis under Linux and setting up related services
  • Under CentOS Linux system Description of the Redis installation process and configuration parameters
  • How to add the iconv module to PHP under Linux
  • Summary of common functions for PHP to execute Linux commands
  • How to install and configure the PHP environment on Linux
  • Set up multi-version PHP coexistence in Linux system and use it with Nginx server
  • Installation and configuration tutorial of PHP-FPM under Linux system
  • How to compile redis and phpredis under Linux

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1119998.htmlTechArticleHow to compile and install PHP extension PDO under Linux (CentOS), centospdo This article describes the PHP extension under Linux (CentOS) How to compile and install PDO. Share it with everyone for your reference, the details are as follows: Here...
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