Fix Passthru System & Exec errors with WordPress Database Manager

I’ve been using WP Database Manager for years now. I reckon it’s the best WordPress Database management plugin. As well as backing up your database it handles automatic optimisation and repair of your database and you can set both that and the backup to run automatically on a schedule. Occasionally though it throws a wobbly. For example it was working fine for me for ages then all of a sudden started giving the following error on the “Backup DB” screen. Admittedly, it might have been due to me updating something on my VPS:

"Checking PHP Functions (passthru(), system() and exec()) ...
passthru() disabled.
system() disabled.
exec() disabled.

I'm sorry, your server administrator has disabled passthru(), system() and exec(), thus you cannot use this backup script. You may consider using the default WordPress database backup script instead."

The above error meant that database backups couldn’t run which rendered the plugin useless.

Here’s a quick fix:

Create a file called “php.ini” and upload it to your wordpress/website root folder. Add the following code to your existing .htaccess file and re-upload:

suPHP_ConfigPath /home/YOUR-ACCOUNT/public_html

order allow,deny
deny from all

Swap “YOUR-ACCOUNT for the username on your hosting account.

PS – The above fix might be considered a security risk for some shared hosting providers.

Leon

Advertisements

Gravity Forms + Stripe Curl_Exec Issue

At the time of writing this the Gravity Forms + Stripe WordPress extension/plugin for Gravity Forms is about the only extension that will add a proper credit card fieldset to an existing form created with the excellent Gravity Forms plugin. I had been taking credit card details via credit card fields setup manually in Gravity Forms then inputting the details in my Stripe account but that was hassle and allegedly a bit insecure!

Unfortunately, my VPS server wasn’t setup correctly to handle the Stripe calls and after having installed The Gravity Forms + Stripe plugin I noticed none of my forms were visible anymore. After a few emails back and forth with the plugin developer Naomi and turning off all my other plugins except Gravity Forms and Gravity Forms + Stripe, I got the following error message:

Warning: curl_exec() has been disabled for security reasons in
/home/reverbst/public_html/wp-content/plugins/gravity-forms-stripe/includes/api/lib/Stripe/ApiRequestor.php
on line 176

To sort this out I had to edit my VPS php.ini file to remove the reference to “curl_exec” in the “disable_functions” line. To do this you’ll need access to change your server settings. Non-VPS or shared hosting customers can’t normally change server settings. You can ask your hosting company to do this for you but I’d say it’s unlikely they will. Hopefully your hosting setup is suitable though.

First off, find out where your php.ini file is or which one your server is using by viewing your PHP info. Upload a file called “phpinfo.php” with the following content only:

<!--?php phpinfo(); ?>

Next, open up an SSH session to your server and login as the root user using something like Putty. Add the following commands to edit your php.ini file. The example given relates to the location of php.ini on my server only:

pico -w /usr/local/lib/php.ini

Finally, run the following command to restart apache so the changes are active:

/etc/init.d/httpd restart

My Gravity Forms + Stripe setup now works perfectly! Here’s my payment form:

Reverbstudios.ie/payments/

Leon

How to Increase the WordPress File Upload Limit on Shared Hosting

The upload limit on my clients shared hosting is a measly 2MB which in this day and age is pretty useless as it wouldn’t allow for uploading of most media files, in particular Audio & Video. There are several workarounds, most of which I tried but the following is the only one that seemed to work for me.

Right-click your desktop and select New – Text Document and copy and paste the following lines into the new file:

upload_max_filesize = 32M
post_max_size = 32M
file_uploads = On

You can change the 32M to whatever you like but don’t go mental. Keep disk space in mind!

Next, save the new file as “php.ini” and upload it to the “wp-admin” folder of your WordPress install via FTP or your hosts File Manager.

If you now navigate to Media – Add New in the WordPress admin, you should see 32MB mentioned as the max file size at the bottom. See below:

Media - Upload