[solved] EWWW image optimizer requires exec()

Hello,
I feel your pain my friend, I have been through this shit too. When you are on a shared hosting on namecheap or any other shared hosting, you will find this pile of shit while installing one of the most stupidly awesome image optimizer plugin the EWWW Image Optimizer. For example: “ewww image optimizer requires exec(). your system administrator has disabled this function”.

ewww-exec-error-aiblogs

This is also one of the most common issue for EWWW Image Optimizer plugin on a shared server. You also may have found a solution that requires you to modify the php.ini file of your server. But for that you need the actual php.ini file which is currently running on your server and most of the time that is impossible.

Here is my solution:
First of all we need to get the default php.ini file, we will do that now. Create a new php file on the public_html directory of your hosting called info.php with the following content

<?php phpinfo(); ?>

Now save the file and run it on your server from browser like http://www.yourdomain.com/info.php, when the page loads look for the following

Loaded Configuration File

Now copy the path to your php.ini file and put it in a text file for future use. Now go to the info.php file and edit it. Replace all the previous lines with the following

<?php system("cp /location_of_your_default/php.ini /location_of_your_new/php.ini"); ?>

Don’t forget to add the location to your default php.ini which we saved on a text file and the place where you want to put the one that you want to edit. If everything goes well, you will be able to see your new dafault php.ini file on the location which you provided. And now we can edit it to enable exec(). For that look for the following line line in your newly copied php.ini file

disable_functions = "show_source, system, shell_exec, exec"

and now replace it with the following

disable_functions = "show_source, system, shell_exec"

So we are basically removing exec for disabled function list. Now you may have to add a few lines to your htaccess file to make the changes global. Add the following lines to your .htaccess file

<IfModule mod_suphp.c>
suPHP_ConfigPath /directory_location_of_your_new_php.ini_file/
</IfModule>

Don’t forget to add the location to your new and edited php.ini file. Otherwise you might get an internal server error.
Thats it. You should be done now. Go to your EWWW Image Optimizer plugin’s admin page and check.

I hope this helps. Cheers!! 😉

Leave a Reply