Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install PDO of PHP under Linux

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "how to install PHP PDO under Linux", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to install PHP PDO under Linux" article.

PDO (PHP Data Objects) is a user interface to connect to a database in PHP. PDO and mysqli have been suggested to replace the mysql-related functions originally used by PHP, based on the security of database use, because the latter lacks protection against SQL injection. The PHP data object (PDO) extension defines a lightweight and consistent interface for PHP to access the database. Each database driver that implements the PDO interface can expose the characteristics of a specific database as a standard extension. Note that extending with PDO does not implement any database functionality by itself; you must use a PDO driver for a specific database to access the database service.

Environment:

Server system: Centos6.5 (virtual machine demonstration)

PHP package storage directory: / data/php-5.6.14/

PHP installation directory: / usr/local/php/

Mysql installation directory: / usr/local/mysql/

Operation procedure:

Through the phpinfo () function, we can check whether the server has the PDO extension installed. If the PDO extension information is not found, let's install it by the following steps: find your PHP installation package (mine is in the / data/php-5.6.14/ directory), go to the pdo_mysql directory of the PHP extension, and run the following command:

/ usr/local/php/bin/phpize

(/ usr/local/php/ is my PHP installation directory, you can modify it according to the actual situation)

After executing the above command, we will find that the configure file appears in the current pdo_msyql directory.

So we carry out the following orders:

. / 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/ specifies the location of the installation directory of the MySQL database (here, the installation directory of PHP and msyql depends on your actual situation)

Continue to compile and install:

Make & & make install

After the command is executed, the effect is as follows:

The directory sufficient for the last line, which will be used later, is where the generated pdo_mysql.so file is located:

Next, let's modify the PHP configuration file, open your php.ini file, and add a line of code:

Extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/pdo_mysql.so

(here is the pdo_mysql.so directory I demonstrated. When you set it up, add it according to your actual directory.)

Finally, save the launch and restart the service. Then use the phpinfo () function to check whether the PDO extension is installed successfully, and the results are as follows, indicating that the PDO extension is installed successfully.

The above is about the content of this article on "how to install PDO of PHP under Linux". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report