php-mysqlHow to install the PHP MySQL extension on Ubuntu?
- Install the
php-mysql
package using apt:
sudo apt-get install php-mysql
- Enable the extension in the
php.ini
configuration file:
extension=mysql.so
- Restart the web server to apply the changes:
sudo service apache2 restart
- Verify the installation by creating a
phpinfo.php
file:
<?php
phpinfo();
?>
- Access the file in a web browser and check for the
mysql
section in the output:
mysql
MySQL Support => enabled
Client API version => 5.7.25
Helpful links
More of Php Mysql
- How to use utf8mb4_unicode_ci in MySQL with PHP?
- How to join tables with PHP and MySQL?
- How to get the version of MySQL using PHP?
- How to write an update query in MySQL using PHP?
- How to count the number of resulting rows in a MySQL database using PHP?
- How to use a MySQL union in PHP?
- How to set a timeout for MySQL query in PHP?
- How to create an SSL connection to MySQL using PHP?
- How to get the last insert ID in PHP MySQL?
- How to fetch data from MySQL in PHP?
See more codes...