9951 explained code solutions for 126 technologies


php-mysqlHow to install the PHP MySQL extension on Ubuntu?


  1. Install the php-mysql package using apt:
sudo apt-get install php-mysql
  1. Enable the extension in the php.ini configuration file:
extension=mysql.so
  1. Restart the web server to apply the changes:
sudo service apache2 restart
  1. Verify the installation by creating a phpinfo.php file:
<?php
phpinfo();
?>
  1. 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

Edit this code on GitHub