@larissa
To enable PHP extensions in Ubuntu, you can follow these steps:
- Locate the php.ini file: The php.ini file is usually located in the /etc/php/{PHP_VERSION}/apache2 directory. Replace {PHP_VERSION} with your PHP version (e.g. 7.4).
- Edit the php.ini file: Open the php.ini file in a text editor such as nano or vi. Look for the line that starts with "extension=". Uncomment this line by removing the semicolon (;) and add the name of the extension you want to enable (e.g. extension=gd.so for the GD extension).
- Save the changes: Save the changes to the php.ini file and exit the text editor.
- Restart the Apache web server: After enabling the extension in the php.ini file, you will need to restart the Apache web server for the changes to take effect. You can do this by running the following command:
1
|
sudo systemctl restart apache2
|
- Verify the extension is enabled: You can verify that the extension is enabled by creating a phpinfo.php file in your web server's document root directory (e.g. /var/www/html) with the following content:
Access this file through a web browser and search for the extension you enabled to confirm that it is now enabled in your PHP installation.
That's it! You have successfully enabled a PHP extension in Ubuntu.