Ran into the Revolution Slider PHP 7 (7.1 & 7.2) Issue? Don’t panic – there is an easy fix for that. Just follow these simple steps!
Problem
Older versions of the Revolution Slider use a function that is no longer supported in PHP7+. Here it is:
mysql_error()
This function is the only reason of your troubles. And there are two ways to fix it. If you can update your Revolution Slider plugin to the latest version, use Solution 1. If you can’t update your Revolution Slider plugin, use Solution 2.
Solution 1
The first and easiest solution is to update your Revolution Slider plugin to the latest version. Duh! This is what I would do anyway because the latest Revolution Slider plugin is compatible and functions well with PHP7+. However, there are times when you can’t update the Revolution Slider. And if that is your case, here is what you could try.
Solution 2
Luckily, the second solution is a no-brainer, too. To get your slider back on track you will need to change two files in your Revolution Slider folder: ‘db.class.php’ and ‘base_admin.class.php’. So get your favorite FTP client and code editor ready and follow these simple steps:
Step 1. Find the db.class.php file here:
/wp-content/plugins/revslider/includes/framework/db.class.php
David A Schlussel reported that the folder “includes” may laso be “inc_php”, so make sure to check it as well.
Step 2. Change the checkForErrors function (very likely on line 31) to the following:
private function checkForErrors($prefix = ""){ global $wpdb; if($this->wpdb->last_error){ $query = $this->wpdb->last_query; $message = $this->wpdb->last_error; if($prefix) $message = $prefix.' - <b>'.$message.'</b>'; if($query) $message .= '<br>---<br> Query: ' . esc_attr($query); $this->throwError($message); } }
Then…
Step 3. Find the base_admin.class.php file here:
/wp-content/plugins/revslider/includes/framework/base_admin.class.php
Step 4. Change the $arrMetaBoxes (very likely on line 21) to the following:
private static $arrMetaBoxes = array();
Last step…
Step 5. Refresh your cache, pages and a cup of coffee and try loading the page with the slider again.
Once you’ve done it all, your Revolution Slider PHP 7 (7.1 & 7.2) issue should be gone and you should have a properly working Revolution Slider plugin with PHP 7 (7.1 & 7.2). Voila.
Toni Maragrit
March 01, 2021
Very HAPPY ! THANK-YOU !!!!
LoveinLions
March 01, 2021
Glad to hear that – thank you for the comment.
Rob
November 29, 2020
Thanks very much for the fix. My site is back up and running.
LoveinLions
November 30, 2020
Hi Rob, we are glad that we could help! Thank you for letting us know.
Shawn Nejad
September 13, 2020
Thank you so much
LoveinLions
September 26, 2020
You are very welcome! 🙂
alejandro
August 28, 2020
if i back to php 7.0 i can edit and save the page, but if is php7.4 when edit, i cant save the changes without freeze, the solution that i found it is back to php7.0, edit and later set php7.4 again
alejandro
August 28, 2020
i do the actualization to php7.4 and it work fine, but when i try to edit any page and click safe and refresh… the editing page gone freeze, i have to go back throug the web browser and did not saves changes
alex
August 28, 2020
you are a really sex machine!! working with php 7.4
GERY
August 26, 2020
Your instructions are galactic, very precise! As a beginner I was able to solve the Revolution Slider problem in a short time. Many thanks from an old pensioner in Thailand!
LoveinLions
August 26, 2020
Hi Gery, really appreciate your comment – happy this solution helped you save time and nerves ?
Chris
July 15, 2020
It actually worked! It seems like suggested fixes I find on the internet rarely work, but this one did. You saved my bacon dude!
LoveinLions
July 17, 2020
This type of comments make us really happy. Thanks Chris for taking the time to leave the comment. Glad we could help! ?
Brandt
July 10, 2020
Excellent! Also worked with updating to PHP 7.4.
LoveinLions
July 10, 2020
Fabulous, thank you for reporting. Cheers!
Bowler304
May 29, 2020
This worked just like described and my site is up and working again, thank you so much!
LoveinLions
May 29, 2020
Happy it worked and appreciate your comment – thank you.
Aurélie
May 06, 2020
Thank you so much!
LoveinLions
May 06, 2020
Glad we’ve helped. Thank you Aurélie!
Simon
April 17, 2020
Hi,
THANK YOU VERY MUCH!!! VERY USEFULL THIS TUTORIAL. WORKING AND FIXED THE ISSUE!! YOU SAVE MY WORK!!
LoveinLions
April 17, 2020
Super happy that it helped you! Thank you for confirming.
CedriKo
October 19, 2019
Hi,
Thanks for this tips !
I’ve this error : Parse error: syntax error, unexpected ‘&’ in xxxx/wp-content/plugins/slider-revolution/includes/framework/db.class.php on line 35
The line 35 is this one : if($this->wpdb->last_error){
Can someone help me.
I’ve try the alternative code given by ALEX FERRE but it doesn’t work for me.
Sorry for my bad english (i’m french) and thanks you by advance for your help
Pablo Esquivel
February 22, 2019
Thanks, Vladi.
Where can I found this thing (a.asad) in custom CSS file?
– Is in wp-includes or wp-admin?
– After that, I see a lot of CSS file (about.css, customize-controls.css)
Vladi
February 22, 2019
You won’t find this code. You will need to add it. And you can do it in at least two different ways:
1. Find the file called style.css. Go to: wp-content – themes – YOUR THEME – style.css (it may also be inside the folder called styles). If you have a backup copy you can do a search.
2. Go to Appearance – Customize – Additional CSS (or similar) – and add the code there.
Pablo Esquivel
February 15, 2019
Hi Vladi. Thank for the answer. I think that I am fine with the solution that I have found: replace a still photo with the slider. Maybe in the future I’ll take up the subject again. Thank you for your interest, because I know it is complicated for you to know what exactly happens to the web. Finally, I wanted to ask you: How can I remove the red button from the home where the Skype icon is? Thanks.
Vladi
February 16, 2019
Hi Pablo. I am glad you found an alternative that works. I would also suggest “unlinking” the image so it does not link to the actual image.
Re: the Skype button, you may have theme settings to hide it but otherwise consider adding the following to your Custom CSS file:
a.asad {
display: none;
}
Alex Ferre
February 13, 2019
I found it.
I checked on another post and found another code for line 31 (checkforerrors function) that works perfectly for me. No &s by the way.
private function checkForErrors($prefix = “”){
if(function_exists(‘mysql_error’)){
if(mysql_error()){
$query = $this->wpdb->last_query;
$message = $this->wpdb->last_error;
if($prefix) $message = $prefix.’ – ‘.$message.”;
if($query) $message .= ‘— Query: ‘ . $query;
$this->throwError($message);
}
}
}
Vladi
February 16, 2019
Hi Alex, thank you for sharing your solution. I will add a note in the post about this if it helps anyone else. Thank you!
Alex Ferre
February 13, 2019
I got the same.
syntax error, unexpected ‘&’ in /***/***/***/***.com/wp-content/plugins/revslider/includes/framework/db.class.php on line 34
Vladi, can can I “work around” this?
Thanks
Vladi
February 16, 2019
Hi Renee, Alex Ferre in the comments below seems to have found a workaround around that “&” ?
Pablo Esquivel
February 11, 2019
Thank you, RENEE and VLADI. I deleted the revslider plug-in from the wordpress editor. Is it possible that this is not found in filemanager.one.com? A point has arrived that I do not know if to recover the Revolution Slider or to remove it, because I do not find solutions. Sorry for the inconvenience.
renee
February 08, 2019
Hi Vladi, many thanks for this post! I tried solution2 as revslider came with the theme so I can’t update it but I get the following error after refreshing the cache and pages:
Parse error: syntax error, unexpected ‘&’ in /***/***/***/***.com/wp-content/plugins/revslider/includes/framework/db.class.php on line 34
Any ideas would be very helpful!
Vladi
February 10, 2019
Hi Renee, it is hard to say without testing. Have you tried working around that unexpected “&” on line 34 of the db.class.php?
Pablo Esquivel
January 27, 2019
Hello, Vladi. I followed the 5 steps of the post but something did not work, as you can see in the image that you can see in the comment above. What I can do?
Vladi
February 10, 2019
Hi Pablo. Sorry for the late reply. I have checked your website and I can see you still haven’t got the slider working 🙁 It looks like there is a database issue but it is hard to say what it is exactly from just looking at a screenshot and would require testing.
Carsten
January 25, 2019
Hi Vladi,
I have seen that solutions on some sites and did exactly what you also described here, but still my site does not work with Rev Slider under PHP 7.1+
Do you have any hints for me what I can do?
Thanks a lot!
Carsten
Vladi
February 10, 2019
Hi Carsten. It is hard to say without having any details.
Pablo Esquivel
January 23, 2019
Thanks, Vladi. The 5 steps were made and I get an error in… if($this->wpdb->last_error){ Click here for a screenshot: https://prnt.sc/maxj8j
Vladi
February 10, 2019
Hi Pablo. I’ve noticed you filed a question with OceanThemes. Please let me know how it goes.
Pablo Esquivel
January 22, 2019
Thanks for answering, Vladi
No, only I see:
revslider-admin.class.php and revslider.php
Inside the plugins folder, in turn inside the revslider folder. I don’t see a file with the name db.class.php
Vladi
January 23, 2019
Weird. “Revslider” plugin folder usually has 3 php files and 5 folders. One of those folders is called “includes” and has a subfolder called “framework”. The plugin wouldn’t be able to work without them. Click here for a screenshot of what I mean. Let me know what is inside the MAIN plugin folder “revslider” on your side.
Pablo Esquivel
January 21, 2019
Hi, Vladi. I have to do the second step but I do not know how to do it. I understand that I have to enter dbadmin.one.com and edit that part of the code. But where can I find it? Because I do not achieve it. I do not know if it’s in the folder revslider_css, revslider_sliders, revslider_layer_animations … If you can guide me, I’d appreciate it.
Vladi
January 22, 2019
Hi Pablo. Have you tried examining the db.class.php file that is located here: /wp-content/plugins/revslider/includes/framework/db.class.php ?
Craig L Boudria
December 06, 2018
So helpful!!! Thank you very much
Vladi
December 06, 2018
You are very welcome! 🙂
Birgitta
November 03, 2018
Hi Vladi,
Your help was very grateful!
Vladi
December 06, 2018
Awesome, thanks!
Aldi
November 01, 2018
This helped me! Thank you.
Vladi
December 06, 2018
No worries! 😉
Silvia
November 01, 2018
Thanks a lot!! You are my hero of the day 😉
Vladi
November 01, 2018
Very welcome!
Bart Roelofs
September 12, 2018
My hero!!! This worked for updating my server to php 7.2!
Vladi
September 13, 2018
Glad it was helpful! Thank you 🙂
David A Schlussel
April 24, 2020
thanks so much! however, in my version the directory is different, it’s not
/wp-content/plugins/revslider/includes/framework/
it’s
/wp-content/plugins/revslider/inc_php/framework/
LoveinLions
April 24, 2020
Glad it worked and thank you for the note – adding it to the article.