Support

Akeeba Backup for WordPress

#35273 Site restoration: Trouble with PHP auto-prepend mode

Posted in ‘Akeeba Backup for WordPress’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

WordPress version
n/a
PHP version
n/a
Akeeba Backup version
n/a

Latest post by nicholas on Monday, 24 May 2021 11:52 CDT

maddin99

Hello,

I am trying to restore a Wordpress site on a new server and keep getting the message "We detected that you have one or more files using PHP auto-prepend mode" (see attachment for a screenshot).

I have already disabled all kinds of plugins before starting the backup, including security and caching-plugins, but keep getting this error. Is there a way to find out which plugin is causing this?

Also: Wouldn't it be a good idea to output this notification once the backup has finished?

Thanks!

Best regards

Martin

nicholas
Akeeba Staff
Manager

This is not an error message, it's a warning message so you are aware of this. We give you the option to remove any auto-prepend scripts during restoration.

This warning CAN NOT be possibly printed at backup time. It is something detected at restoration time. Auto-prepend scripts can be set up by .htaccess, .user.ini or php.ini files which may not be present in your backup but present on the site you are restoring to. Showing you a backup time warning would only be based on what is the case on the site you are backing up, not the site you are restoring to. However, this is something that will only affect the restored site, i.e. it only makes sense to warn you at restoration time.

In either case, as I said, we give you the option to remove auto-prepend scripts by removing the .user.ini / php.ini files and resetting the .htaccess files in the Site Setup page (second to final page during the restoration). So there's really nothing else we can do. We already notify you about a potential problem and give you the tools to fix it.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

maddin99

As it turns out, the issue was something else: I just discovered that the wp-config.php file is empty after restoration. Once I create a new file based on wp-config-sample with the database credentials of the new server the page is working again. Do you have any idea why the wp-config.php would not be restored?

nicholas
Akeeba Staff
Manager

Do you have a wp-config.php file in your site's root? If not, it's not backed up therefore it's not restored. The Site Setup page showing no information about your backed up site should be a dead giveaway that this is the problem.

Does it follow the wp-config-sample.php structure? If not — for example if it has if-blocks to change the defines based on live / dev configuration on some WP-specific hosts or if it includes files from other locations — it cannot be read correctly when you are restoring your site, therefore its contents may be empty following the restoration. Again, the Site Setup page during restoration would appear to have no information about your backed up site.

Finally, if PHP failed to write to the wp-config.php file after you clicked Next in the Site Setup page of the restoration script but did not report an error back to us you may have ended up with an empty file. I have not seen that happening and it's extremely unlikely but in theory it's still possible.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

maddin99

That's it - on the backed up server, the wp-config is located outside a wordpress subfolder which contains the installtation. I've never seen that before, so I didn't think of checking this. 

Thanks for your support.

nicholas
Akeeba Staff
Manager

You're welcome!

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!