Migrate WordPress from PHP 5 to PHP 7

If your website’s PHP version Because PHP is not the same as the PHP version in your backup, it may cause issues with the proper operation of your website and with some applications. This is more common when migrating from PHP 5 to PHP 7.

We recommend that users regularly backup their WordPress sites or network of sites. You can also use the All-in-One WP Migration plugin extensions to set up automatic backups. Make sure your plugin version is always up to date.
In most cases, the PHP update will have no effect on WordPress or popular plugins or themes. However, it is possible that some plugins, themes, or other functionalities will cease to function.

Set the WP_DEBUG constant to true in your wp-config.php file to see all errors, warnings, and notes generated by the website during execution. This will assist you in locating any problems.

If your install is stuck at “restoring X% files,” “restoring database,” or “activating mu-plugins”

1. Leave the plugin running for another 15 minutes while it is on “Restoring database.”
2. After 15 minutes, open another tab and attempt to login to wp-admin using the exported site’s WP Admin username and password.
3. Save the permalinks structure twice by going to settings -> permalinks.
Your website should now be successfully migrated.

If it isn’t and you receive a 500 error, please edit your wp-config.php file and set WP_DEBUG to true, then refresh the page to see an error. This may assist you in determining the problem, or you can share the error with the Servmask support team for assistance.

Could it be my server settings?

Memory limit needs to be at 256M, max_execution_time to 500, and mysql.connect_timeout to 400. You can find these settings by uploading this file. (https://www.dropbox.com/s/ize8t2k4nww5iq7/phpinfo.php?dl=0) in wp-content of your imported site and then open http://YOURDOMAINNAME.COM/wp-content/phpinfo.php. (tip – use Ctr F search the data that you get)

28 Comments

  1. Bobo

    Hey Guys,

    I just imported my website, coming from a php5 webhotel… This new webhotel is running php7… How can I see if all is good now, and that all is working as it should?

    1. Pim J. Iliev

      Hi Bobo,

      If the import completed with no fatal errors showing up on the homepage, it should be working good.
      Are other plugins or your current theme working well? Have you tried editing something to see if it works?

      1. Neels

        Hallo Pim

        I did wait the 15 min on the database restore, but it just have a white screen if I go to the login page. it is from PHP5 to 7. Just one thing you will not be able to access it, working on a other server not public yet. the old site is live.

  2. Dan

    Hi I’m stuck on “Done activating mu-plugins” and when I try to navigate to my WP Admin login as mentioned above I get “Parse error: syntax error, unexpected ‘new’ (T_NEW) in /home/ydgg2z9f4z0s/public_html/wp-content/plugins/wp-o-matic/wpomatic.php on line 2004”

    I’ve already put WP in debug mode, but not sure what to do next.

    Thanks!

    1. Pim J. Iliev

      Hi Dan,

      I am sorry for the inconvenience.
      Could you edit your wp-config.php file as follows and let me know if that fixes your issue;
      define(‘WP_DEBUG’, false);
      define( ‘WP_DEBUG_DISPLAY’, false );
      @ini_set( ‘display_errors’, 0 );

  3. Awareness

    Community Message to ServMask:

    Line 3 in the above article should alert users to logging into a debug log rather than just outright saying enabling WP debug to true and be done with – or at very least link out to the Codex.

    Especially, for those of us who don’t use WP often and have to conduct the once in a while migration job.

  4. David

    I am trying to import an existing site locally. The site is stuck at Restoring Database 99%. The site will load but I cannot get into the admin section. Below is the error I get.

    Fatal error: Uncaught Error: [] operator not supported for strings in /app/public/wp-content/plugins/revslider/includes/framework/base-admin.class.php:71 Stack trace: #0 /app/public/wp-content/plugins/revslider/admin/revslider-admin.class.php(572): RevSliderBaseAdmin::addMetaBox(‘Revolution Slid…’, ”, Array, NULL) #1 /app/public/wp-content/plugins/revslider/admin/revslider-admin.class.php(73): RevSliderAdmin->addSliderMetaBox() #2 /app/public/wp-content/plugins/revslider/admin/revslider-admin.class.php(44): RevSliderAdmin->init() #3 /app/public/wp-content/plugins/revslider/revslider.php(163): RevSliderAdmin->__construct(‘/app/public/wp-…’) #4 /app/public/wp-settings.php(305): include_once(‘/app/public/wp-…’) #5 /app/public/wp-config.php(76): require_once(‘/app/public/wp-…’) #6 /app/public/wp-load.php(37): require_once(‘/app/public/wp-…’) #7 /app/public/wp-admin/admin.php(31): require_once(‘/app/public/wp-…’) #8 {main} thrown in /app/public/wp-content/plugins/revslider/includes/framework/base-admin.class.php on line 71

    1. Yani I

      Hi David,

      Go to your server via FTP and rename /app/public/wp-content/plugins/revslider to /app/public/wp-content/plugins/revslider-bak
      The site should be working now.
      Update revslider to the newest version and enable it.

  5. Michael

    I am trying to import an existing site from php5 to php7 (GCP). The import goes fine, then I login to admin page, it also looks fine. But when I click to homepage, it appears “500 error”. (I have done to save permalink structure twice.)
    Please guide me to solve the problem, thanks.

    1. Pim J. Iliev

      Hi Michael,

      There might be some plugin or theme that is causing your website a “500 error”.
      Could you edit your wp_debug to true in the wp-config.php file, refresh the frontend and send us the error you see to

      su*****@se******.com











      ?

      Thank you!

  6. Byron Wilkins

    Greetings. My import was stuck on the screen “Finished setting up blog” or similar language. I have opened up my wp-config.php file and do not see any reference to WP_DEBUG, so I’m a little lost. I have deleted the site on the new host and set it back up so it is ready to import, but obviously I’m going to need to fix something for the import to complete properly. Any help would be great! Thank you.
    Byron

  7. Daniel Herrick

    This is my 5th attempt to install ReHub theme with completely brand new WP installs. I used the All-In-one-Migration plugin as before but have not interrupted the install as I did previousely. It has been over 3 hours being stuck on this message https://www.screencast.com/t/UKiKW3Z4YBN.

    I opened a new tab to get these results:

    1) upon opening the home page: https://www.screencast.com/t/Fcg5zLOD9

    2) attempting to open the wp-admin area. https://www.screencast.com/t/nl77zxJN

    During a previous attempt there was a warning that this install is from PHP 5.0 and may not work on PHP 7.0. So I switched to PHP 5.1 and the installation failed due to WP 4.9.8 requires at least PHP 5.2.

    Upon switching to PHP 5.2 I got this error: https://www.screencast.com/t/jEjWArJuMRo8

    I also tried: FTPing the rehub *.wpress file into /wp-content/ai1-backups but the wp-admin crashes when trying to access the All in one migrate.

  8. Pauline

    Hi Guys,

    After 15 minutes, I follow the different step and get a 500 error, edit wp-config.php file and set WP_DEBUG to true. Then I refresh the page, I have a Fatal error…

    Fatal error: Cannot redeclare ultimate_get_banner2_json() (previously declared in /home/paulineost/www/wp-content/plugins/Ultimate_VC_Addons/modules/Ultimate_Functions.php:27) in /home/paulineost/www/wp-content/plugins/Ultimate_VC_Addons/modules/ultimate_functions.php on line 48

    Can you help me ? What have I to do ?

    Pauline

    1. Pim J. Iliev

      Hi Pauline,

      Please rename Ultimate_VC_Addons in wp-content/plugins to Ultimate_VC_Addons_ using FTP and refresh the frontend to see if the website shows up.

  9. Nicolas Gendron

    Hi,

    I tried to import 700MB website into an “WordPress Certified by Bitnami and Automattic-5-0-2-1” EC2 instance.
    The import was stuck at 98% on “Restoring Database”. I then:
    – Wait 15 min.
    – Try to refresh, but got an blank page
    – Enabled WP_Debug

    And finally got this error.

    Fatal error: Uncaught Error: Call to undefined function mysql_error() in /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/revslider/inc_php/framework/db.class.php:57
    Stack trace:
    #0 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/revslider/inc_php/framework/db.class.php(247): UniteDBRev->checkForErrors(‘fetch’)
    #1 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/revslider/inc_php/revslider_params.class.php(83): UniteDBRev->fetch(‘wp_revslider_se…’)
    #2 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/revslider/inc_php/revslider_operations.class.php(2057): RevSliderParams->getFieldFromDB(‘general’)
    #3 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/revslider/settings/general_settings.php(81): RevOperations::getGeneralSettingsValues()
    #4 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/revslider/inc_php/framework/base_admin.class.php(681): require(‘/opt/bitnami/ap…’)
    #5 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/revslider/revslider_admin.php(111): UniteBaseAdminClassRev::require in /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/revslider/inc_php/framework/db.class.php on line 57

    Any ideas?

  10. Las

    Hi
    I seem to be stuck on 10% when attempting to import the backup file. I’ve waited 30 minutes but nothing happens and I’ve tried opening the admin cpanel on a different browser but the import isn’t working.

    I am on a dedicated server, and have changed the php settings to 256mb memory, execution to 500mb, time limit to 400mb, post max to 600mb and file upload to 500mb. And nothing seems to be working.

    Any ideas on what to do next to get this backup loaded?

  11. Adams Lu

    Hello,

    I’m migrating from PHP7 to PHP8 and the restore process is stuck at 0% with the following errors:

    Warning: Trying to access array offset on value of type null in /Applications/MAMP/htdocs/kh2024/wp-content/themes/inmedical/framework/theme-function.php on line 1284

    Fatal error: Unparenthesized `a ? b : c ? d : e` is not supported. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in /Applications/MAMP/htdocs/kh2024/wp-content/plugins/js_composer/include/classes/editors/class-vc-frontend-editor.php on line 646

    I’d appreciate your suggestion on how to fix this.
    Thank you

  12. duda possamai

    Hi, I’m migrating from php7 to php8 and the process finishes with no problem, but the wpress file I tried to import do not updated. On the edit screen of wordpress it seems fine, but when I access the site it shows the old layout. What do I do?

Leave A Comment?