http 500 error on my site
-
Just updated this plug in to 7.3.1 after PHP 7.2 update. In error logs I get this
PHP Fatal error:Uncaught Error: Cannot use object of type WP_Error as array in
/nas/content/live/my-site/wp-content/plugins/better-wp-security/core/modules/backup/class-itsec-backup.php98\nStack trace:\n#0Therre are other files listed too but this is the first one.
Any suggestions as to where I can look for a fix?Disabling it gets the site back up again.
-
You may be interested in reading this topic.
Thanks for the info. This on hold for now.
Hello, just now reviewing your response. Can you tell me exactly what should be in the $http_home/wp-content/uploads/ithemes-security/backups).Folder, adn the content of any sub folders?
This is a concern at the moment, some other WP sites have different content to this.
Thanks.Initially there is only an index.php file in the backups folder. If the Database Backup module is enabled there may be any number of backup files that look like below:
backup-first20charsitetitle-20190305-124732-KohBJzh9QxOi2ulMDbxBRfU4vYATm8.zip
Usually there are no subfolders.
I don’t think the backups is enabled. Not sure where to check.
Structure is
Ithemes-security
this has backups folder
logs folder and .htacces and index.php file
Still getting 500 errors on the site and that same error log in the log file, the only fix is to disable iThemes plug in. Trying to pin down what this is but with no luck so far.-
This reply was modified 7 years, 3 months ago by
robmcp.
With the Database Backup module disabled you would probably not run into the error:
Uncaught Error: Cannot use object of type WP_Error as array in …
On the plugin Settings page if the Database Backups tile shows both a Configure Settings and a Disable button then the module is enabled.
What is the content of the .htaccess file in the ithemes-security folder ? And what version of Apache is the site running on ?
5 Star reply nlpro.
Well! The things you didn’t know you didn’t know. I hit disable, and it now ‘seems’ to work in that I am not getting http 500 errors on the site and iThemes is running again.The odd thing was, the settings on that site are the same as others which do not exhibit this issue.
I’d like to thank you for your time and help with this – sorry it was a slow to and fro, but I was not able to look at this until the last day or so..
Disabling the Database Backups module is more like a workaround. Preferably you would like to have that module enabled.
I think we are closer to a REAL solution than you think.
All you need to do is answer 2 questions:
What is the content of the .htaccess file in the ithemes-security folder ?
And what version of Apache is the site running on ?I don’t actually have a problem in disabling the backups option as this is done elsewhere, though I would like to understand why it breaks the site.
NGNIX hosted, an htacess file has deny from all in it
-
This reply was modified 7 years, 3 months ago by
robmcp.
Indeed if you are using an alternative backup solution having the Database Backups module disabled is fine.
When NGINX hosted, .htaccess files have no purpose. So one not being present in the WordPress root folder is as expected. The existing one in the ithemes-security folder is a leftover from a very old iTSec release. It was a very buggy release that created .htaccess files irrespective of which webserver was being used. The content syntax (deny from all) also only supported Apache 2.2 (or older) and it could cause problems when using Apache 2.3 or 2.4 where the authorization syntax changed. That’s why I asked for this info. Anyway since its NGINX based we can throw that theory out of the window. My recommendation is to delete the .htaccess file in the ithemes-security folder. Just to tidy things up (the iTSEc plugin should have done that when updating to a newer release in the past).
There is 1 other option. We know there is a problem with creating database backups. Due to a bug introduced in the Database Backups code of the 7.3.0 release there is no usefull error being reported. The current error is a PHP syntax error which prevents the plugin from returning a meaninfull database backup error. However the PHP syntax error bug just got fixed in the latest iTSec Pro release.
You could backport the Pro fix into the free plugin 7.3.1 database backup code. That way we might get a meaningfull msg from the plugin when it fails to create a database backup. Note that the same fix will be included in the next free plugin update (probably 7.3.2, perhaps 7.4.0) which is expected to arrive shortly.Backporting the Pro fix into the free plugin 7.3.1 database backup code is quite simple:
1. Create a backup copy of the current better-wp-security/core/modules/backup/class-itsec-backup.php file.
2. Edit the better-wp-security/core/modules/backup/class-itsec-backup.php file. Add lines 86, 87 and 88 such that the end result looks like below:76 public function do_backup( $one_time = false ) { 77 78 if ( ! ITSEC_Lib::get_lock( 'backup', 180 ) ) { 79 return new WP_Error( 'itsec-backup-do-backup-already-running', __( 'Unable to create a backup at this time since a backup is currently being created. If you wish to create an additional backup, please wait a few minutes before trying again.', 'better-wp-security' ) ); 80 } 81 82 ITSEC_Lib::set_minimum_memory_limit( '256M' ); 83 $result = $this->execute_backup( $one_time ); 84 ITSEC_Lib::release_lock( 'backup' ); 85 86 if ( is_wp_error( $result ) ) { //new line 87 return $result; //new line 88 } //new line 89 90 switch ( $this->settings['method'] ) {3. Save changes and then reenable the Database Backups module. The PHP syntax error will no longer occur. However the database backups will probably still fail. Hopefully the iTSec plugin Logs page will now report what’s wrong.
No hurry. You probably have other priorities right now.
If a new plugin update is released before finding time for the backport option then simply forget the backport instructions and update to the new plugin release. Again reenable the Database Backups module and keep an eye on the plugin Logs page. -
This reply was modified 7 years, 3 months ago by
The topic ‘http 500 error on my site’ is closed to new replies.