By adam sar
I am NOT a technical person, so im trying to download a backup manager extension for my app on the droplet but it requires:
the exec() function enabled in your PHP install since it will call a few command line commands to create the backups. Additionally, this only works on a linux environment where the “tar” and “mysqldump” commands are available (99% of linux servers have them)
is there detailed steps on how i can do this in putty or winscp? i have a lamp on ubunutu 20.04 using php version 7.4.3
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Hello, @adamSar
If you’ve already configured the LAMP stack (Linux, Apache, MySQL, PHP) setup using our tutorial:
How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 20.04
then PHP is already configured as you mentioned the version is 7.4.3
You can create a PHP info file and check if the exec function is enabled/disabled. You can create a file named phpinfo.php (the name doesn’t really matter) and put the following content in the file:
<?php
phpinfo();
?>
The file must be present inside your public_html folder so you can then access the file via your browser and check the PHP information. Once the file is added go to your browser and access the file using your domain name or IP address, e.g yourdomain.com/phpinfo.php or IPaddress/phpinfo.php
You can search for disable_functions
and if exec
is listed it means it is disabled. To enable it just remove the exec from the line and then you need to restart Apache and you will be good to go.
If exec
is not listed in the disable_functions
line it means that it is enabled.
Hope that this helps! Regards, Alex
Hi @adamSar,
If you already have PHP installed on your droplet, you can SSH to it, create a new file, for example test_exec.php
like so
touch test_exec.php
Then inside of it, add the following
<?php
if(function_exists('exec')) {
echo "exec is enabled";
}
Save the file and execute it like so
php test_exec.php
If it returns an output of exec is enabled
, you’ll know you have exec enabled.
Now, if you don’t have PHP installed.
Ubuntu
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
Install PHP 7.3 for Apache
sudo apt install php7.3
Install PHP 7.3 for Nginx
sudo apt install php7.3-fpm
Install PHP 7.3 Extensions
You can use the following command to install the most needed PHP extensions
sudo apt install php7.3-common php7.3-mysql php7.3-xml php7.3-xmlrpc php7.3-curl php7.3-gd php7.3-imagick php7.3-cli php7.3-dev php7.3-imap php7.3-mbstring php7.3-opcache php7.3-soap php7.3-zip php7.3-intl -y
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.