• PHP Help
  • Wordpress detected my site is running on insecure version of PHP.

Hello. I'm new here and not a coder, but... Wordpress tells me I need to update from PHP version 5.6 to version 7.0 or 7.2 or 7.3. When I go to my server/cPanel and use MultiPHP Manager to change from 5.6 to 7.2, I get a fatal error and lose my site until I change it back. The error reads:

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/username/public_html/wp-includes/wp-db.php:1668 Stack trace: #0 /home/username/public_html/wp-includes/wp-db.php(632): wpdb->db_connect() #1 /home/username/public_html/wp-includes/load.php(425): wpdb->__construct('username', '!pass', 'username...', 'localhost') #2 /home/username/public_html/wp-settings.php(116): require_wp_db() #3 /home/username/public_html/wp-config.php(90): require_once('/home/username/...') #4 /home/username/public_html/wp-load.php(37): require_once('/home/username/...') #5 /home/username/public_html/wp-blog-header.php(13): require_once('/home/username/...') #6 /home/username/public_html/index.php(17): require('/home/username/...') #7 {main} thrown in /home/username/public_html/wp-includes/wp-db.php on line 1668.

Can anyone tell me what this means? And is it something I can fix?
Thanks! Marie

BTW, I changed themes from a problematic theme to a PHP compatible Wordpress theme, but still the same fatal error.

    The long-deprecated mysql_*() functions finally got removed from PHP. You need to either use the mysqli_() functions, or use the PDO functions (with a MySQL connection). I would like to assume that WordPress has support for one of those, so you may just need to make sure you have the latest stable version of WordPress, as well.

    Thank you so much, NogDog, for your reply. I have the latest version (stable?) of WP (5.3.2)... So this is something that my webhost needs to fix? I just heard back from him and he says the problem must lie with a theme or plug-in. But I changed the theme (it's the only one I have) and I have only one plug-in, which updated just today. I'll send him your response, but I'm wondering, is this something I can change through cPanel? I've seen "MySQL" there... Thanks again!!

      MySQL is not deprecated, just the original mysql_*() functions php used to use. The way to go now is PDO or mysqli. If you're on the latest version of WP then you should be good - they were about a decade behind the times in updating but I believe they finally did do it. What plugin and theme are you using - are they still actively developed? If it's not WP core that's throwing the errors, it's got to be either a plugin or a theme. Try the default Twenty Twenty theme and see if you're still getting error messages.

      maxxd Try the default Twenty Twenty theme and see if you're still getting error messages.

      👍️ Good idea for a quick check.

        Thanks, both NogDog & Maxxd, that's my new theme, the 2020, and theme editor shows "one error" and when I scroll through some of the coding, a lot of warning signs/exclamation marks appear next to some of the lines. But there is an option to "fix now" the "one error" though my site may break. I'll back it up and give it a try. I hope it works.

        Well, the theme error fixed "successfully," but when I went to cPanel and changed PHP to 7.2 and logged back on to my site, I was welcomed with 2 Fatal Errors:

        Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/username/public_html/wp-includes/wp-db.php:1668 Stack trace: #0 /home/username/public_html/wp-includes/wp-db.php(632): wpdb->db_connect() #1 /home/username/public_html/wp-includes/load.php(425): wpdb->__construct('username', '!pass', 'username...', 'localhost') #2 /home/username/public_html/wp-settings.php(116): require_wp_db() #3 /home/username/public_html/wp-config.php(90): require_once('/home/username/...') #4 /home/username/public_html/wp-load.php(37): require_once('/home/username/...') #5 /home/username/public_html/wp-admin/admin.php(34): require_once('/home/username/...') #6 /home/username/public_html/wp-admin/index.php(10): require_once('/home/username/...') #7 {main} thrown in /home/username/public_html/wp-includes/wp-db.php on line 1668

        Fatal error: Uncaught Error: Call to undefined function wp_kses_normalize_entities() in /home/username/public_html/wp-includes/formatting.php:4316 Stack trace: #0 /home/username/public_html/wp-includes/class-wp-fatal-error-handler.php(190): esc_url('https://wordpre...') #1 /home/username/public_html/wp-includes/class-wp-fatal-error-handler.php(147): WP_Fatal_Error_Handler->display_default_error_template(Array, false) #2 /home/username/public_html/wp-includes/class-wp-fatal-error-handler.php(52): WP_Fatal_Error_Handler->display_error_template(Array, false) #3 [internal function]: WP_Fatal_Error_Handler->handle() #4 {main} thrown in /home/username/public_html/wp-includes/formatting.php on line 4316

        Should I try a different theme? WP's 2017 theme got a lot of good reviews. I think I'll try it and see what happens. Thanks!

          NogDog and Maxxd, I hope you're still there. So I installed and activated/published WP's 2017 theme, and again changed the PHP setting (from cPanel) to 7.2, but again got the same 2 fatal errors when I refreshed my site... I'll look at my plugin now, which is WPForms Lite. I also installed Aksimet Anti-Spam plugin but that would be fine, right?

          Later: So I deactivated WPForms Lite, but still got the Fatal Errors, and then deleted WPForms Lite; I still got the same infamous Fatal Errors... So it's not the theme (?) and it's not my innocent plugins, as far as we know...

          So would it be cPanel and MySQL somehow? This time I'll wait for your further advice. I'm out of ideas. Thanks so much!

          I mean, I hope you will be so kind as to give me further advice. God bless you!

            WP will try to use the mysqli extension, if it is present. Since the 1st error indicates it is trying to use the mysql_ extension only, best guess is the mysqli extension is not installed/enabled.

            You need to temporarily create a phpinfo.php file (remove it when finished) with the following in it, browse to this file on your site, and search for mysqli entries in the resultant output -

            <?php
            phpinfo();
            ?>
            

            I suspect you will not find any mysqli entries. Depending on your web hosting, you may be able to install/enable the php mysqli extension either through your hosting control panel or you may need to edit the php.ini.

            I see your post just now, NogDog, thank you, and thanks too to pbismad for your suggestion. Thankfully my webhost took a closer look, after I sent him your earlier responses, and he fixed it! Here's his solution:

            Great news!

            Something they said reminded me of a customer who had a similar issue when upgrading PHP a few months back.

            That customer realized that the upgrade added the following lines to one of their files called .htaccess:

            <IfModule mod_suphp.c>
            suPHP_ConfigPath /home/username
            </IfModule>

            And they found online that if that causes problems, simply removing those lines from the .htaccess resolves the error with no loss of functionality to your site.

            I upgraded your PHP to 7.2 and checked your .htaccess and sure enough those lines were in there. I went ahead and removed them, and voila! Your site is now on 7.2 and no more errors.

            Best Regards,

            Steve Albert, DomainIT
            "Internet With a Smile"

            I included his name and webhosting company as a plug of gratitude to him. I am also VERY GRATEFUL to the three "knights in shining armor" here on PHPBuilders Forum who gave me much hope and encouragement: NogDog, Maxxd and Pbismad (your names/handles are so interesting!). May God bless and reward each of you abundantly!

            I don't know how to mark this issue as resolved, but it certainly is resolved.

            7 days later

            Oh, I also had that problem, I did not want to update PHP either, well, actually I did not know how to do it hehe now I have a development assistant to help me in that and I really don't know what it did, it happened a long time ago My page to watch movies onlinewas one of the newest at that time and now the number of visits it has is astronomical hahaha, in which case is the complete solution of all the comments?

              Write a Reply...