sql.lib.php
This error is caused by a line of code in /usr/share/phpmyadmin/libraries/sql.lib.php
.
If you don’t want to wait for the repositories to update with the latest version, it is strongly recommended that you manually upgrade to the latest version of phpMyAdmin yourself.
Alternatively, you can make a change to sql.lib.php
to temporarily fix the error.
Firstly, backup sql.lib.php
before editing.
sudo cp /usr/share/phpmyadmin/libraries/sql.lib.php /usr/share/phpmyadmin/libraries/sql.lib.php.bak
Edit sql.lib.php
in nano
.
sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php
Press CTRL
+ W
and search for (count($analyzed_sql_results['select_expr'] == 1)
Replace it with ((count($analyzed_sql_results['select_expr']) == 1)
Save file and exit. (Press CTRL
+ X
, press Y
and then press ENTER
)
Import/Export issues
If you are also getting an error Warning in ./libraries/plugin_interface.lib.php#551
under import and export tabs:
Backup plugin_interface.lib.php
sudo cp /usr/share/phpmyadmin/libraries/plugin_interface.lib.php /usr/share/phpmyadmin/libraries/plugin_interface.lib.php.bak
Edit plugin_interface.lib.php
sudo nano /usr/share/phpmyadmin/libraries/plugin_interface.lib.php
Press CTRL
+ W
and search for if (! is_null($options) && count($options) > 0) {
If not found, try search for if ($options != null && count($options) > 0)
Replace with if (! is_null($options) && count((array)$options) > 0) {
Save file and exit. (Press CTRL
+ X
, press Y
and then press ENTER
)
Upgrading phpMyAdmin
You may be interested in an article I wrote on manually upgrading phpMyAdmin. Since the release of Ubuntu 18.04, the repositories have been slow to update with the latest version of phpMyAdmin causing many compatibility issues, so make sure you have the latest version:
Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.
Thanks !!!!!!!!!!!!
Perfect Fix! you are great..! love you
Thanks, you have been very helpful
Muito bom. Obrigado.
Muchas gracias.
Thank you so much!
Perfect! Star rock!!!
you rock dude, big thanks
Thank you for being so clear with you answers, and for covering multiple cases. You are a lifesaver.
Thanks!!!!
Perfect. Thank you very much.
Thanx x 1000000000 times.
🙂
You’re my GOD ^^
It work’s.
Thanks a lot for your help!
By God, it really works with Ubuntu 18.04 server, nginx, php 7.2, phpmydmin 4.6.6deb5 and mariadb 10.1.47.
Congratulations!!!
It is perfectly working in Linux mint 19
Thank you so much
Works like a charm. Thanks
Excellent! You save my life twice.
Thanks so much, it worked! I thought that the replies were bots.
Perfect. Thanks so much. Was getting this all the time when importing csv file. All sorted now.
Thank you very much. It is very helpful.
Amazing!!! it work in my rasberry pi 3 b+. Thank you very much!
Amazing runing smooth now.
Works. Thank you
Thank you! Works great.
Thank you! Works great.
a “sed” solution
sed -i "s/|s*((count($analyzed_sql_results['select_expr'])/| (1)/g" /usr/share/phpmyadmin/libraries/sql.lib.php
thank you!!!
Thank you very much! it work in my rasberry pi 3 b+
Thank you very much! Now everything works fine on my RPI3b+!
Resolved Thanks
Thank you! Works great!
I solve the problem ^^
The sql.lib.php is in
/var/www/new/phpmyadmin/libraries
and not in
/usr/share/phpmyadmin/libraries
Not work for me.
I have tested with all variations (edit sql.lib.php, change to phpMyAdmin 5.x, change to phpMyAdmin 4.9.4)
After changes, phpmyadmin shows the old version and all buttons on left side (under phpmyadmin logo) are disappeared and the EHCP force panel is no longer displayed correctly.
Do you have a tip for me?
Thank you very much! Now everything works fine on my RPI3b!
Hola a todos, ejecute el comando:
sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php
y el resultado fue: “El directorio /usr/share/phpmyadmin/libraries/sql.lib.php” no existe,
estoy en ubuntu 18.04 LTS,
alguna solución,
un millon en gracias.
¿Cuál versión de phpMyAdmin tienes?
Great stuff, thanks!
While it did not necessarily got in the way of using phpMyAdmin, it was rather annoying to see that error every single time.
Thanks for the article. All problems are resolved,
Adamsın
Dankeschön!
Replace it with ((count($analyzed_sql_results[‘select_expr’]) == 1) worked for me.
me too! 🙂
thanks
Thank you for posting the solution, it finally works!
I’m pretty sure there is a typo: an extra parenthesis at the end of the second line.
If not found, try search for if ($options != null && count($options) > 0)
Replace with if (! is_null($options) && count((array)$options) > 0) {
Heh, thanks this has been bugging me for a while, thanks for both fixes.
Thanks a lot!
(How is it possible that a bug like this is still not fixed after months? 🙂 )
thanks a lot
Whats amazing is its nearly 2020 and this issue is still in the official phpmyadmin in the Ubuntu repository. When might it get fixed?
I’ve no idea why they still haven’t updated it. Good for traffic here anyway 😀
The sqllib trick didn’t work, but upgrading phpmyadmin did.
Excellent !
great tut!!!
Gracias!
Thank You 🙂
Thank a lot
Thanks alot!
Thank you!
nice helping
THANK YOU!
Perfecto, Gracias!!… funcionó en LMint 19.2
Thank You Very much…
Thanks! Saved my day!!
Muchas Gracias. Funciona!!!
GREAT, ITS WORK! thank you very much!!!
Thank God for people like you. Much appreciated.
thank you very much!
Absolutley awesome, thank you very much!
This really helped me. Thank you.
Thanks a lot
u’re great!
this is solved my problem 🙂
LOVE
thanks
Woooooooooow 🙂 y’re just an angel ! It worked for me when i modified the files. Thanks a lot
Thank you so much ! It was amazingly helpful !
Tired of that annoying warning message 😀
Cheers, man!
Excelent
Your are a master thanks
It was helpful, thanks!
WOW!!!!!!!!!!!!!! Master!
Thank you so much! This is really helping!
Thanks!!! work for me
GENIOOOOOOOOOOOOOOOOOOOOOOOOO
Muchisimas Gracias
Thank you very much. Any ETA when the phpMyAdmin will be updated for php7.2+ ?
It’s available but not in the repositories yet. You are better off manually updating phpMyAdmin yourself, it’s not that hard.
Thanks you!!
Thank you, problem solved!
Work for me ! 😀
Works’::
You saved me from a world of pain and horror, thank you! Works on Ubuntu 18.04.1 / PHP 7.2.17 / Apache 2.4.29. I was having trouble with exporting and the second fix did it for me. I applied both just in case.
Thanks It’s work! Ubuntu 18.4, PHP 7.2, Apache/2.4.29, version : 5.7.26 !
you saved my mind from these harmful errors
Thanks it solved the problem completely!
Used… thankyou!
Thanks!
For the import/export issue you can replace the code with:
if (! is_null($options) && count((array)$options) > 0) {
Thanks.
With CTRL+W And CTRL+T and type Linenummer of Error (551) you get directly to the line.
Thanks
Thanks for the helpfull patch. Keep it up !
thanks!!
You saved my day. Thanks for this step-by-step solution.
For import/export issue ,
If you don’t find : (! is_null($options) && count($options) > 0)
search : if ($options != null && count($options) > 0)
Import/Export issues
If you are also getting an error Warning in ./libraries/plugin_interface.lib.php#551 under import and export tabs:
Search:
if ($options != null && count($options) > 0) {
It works for me!
Thanks
Thanx! That did the trick.
Amazing… <3
Excelent, resolved straight away!
Obrigado , Muito bom, parabéns!
Nice!
Solved! Great, thanks
you solved it!! Thank you!
Ça fonctionne très bien Merci!
+1 worked great for me. Thanks!
Terima Kasih Banyak.
Sama-sama.
Work like a charm. Thank you.
ok
Thank You So Much DevAnswers…
The one line of code solve the issue….
Great!!!
nice bro! I use vestaCP but having problem with the phpmyadmin.
Work! Update today! 01/12/18.
2019 !
Thank you!
Thank you ! Very useful 🙂
I am facing the import and export error ..
Do you help me correct?
See this comment.
Very nice. Did it via FileZilla. Only download file, edit and upload. Or even edit it via nano and save. Reload the page in phpmyadmin and the error isnt there anymore. Thank you very much 😀
Thank you. Works!
Please can do phpmyadmin error on php7.3
thanks
Please I have error with phpmyadmin using php7.3
if you can do the correction for us. thank you
this is work on my Ubuntu 18.04 Budgie version.. Thanks a lot
it’s working thank you
Thanks!
This did not work for me on Ubuntu 18.04
Thank you, works !
i can see sql.lib.php in my phpadmin directory. Please help I am using Ubuntu 17.10
Anybody there..?? Please help
Thanks!
millon gracias!!! :* :* :*
Thank you. Works!
The problem of mine is solved…. Thank you.
Thanks so much. Very useful!
You saved my day. Thank you
you saved my life lol
Thanks, that worked!!!!
Gracias
Solved the problem with ubuntu 18.04 nginx php7.2-fpm phpmyadmin 4.6.6.
Thank you!!!
I have vesta cp… it works!!!!
Thank you for a clear and simple solution!
It’s works!!!
The best way and explanation to fix it, many thanks
Works! 🙂
Thank you!
Man!!! Thanks! Thanks! Thanks!!!
thank’s a lot,this site is very helpful
Thanks, that’s great !
Its working for me..thanks
Muy bien
Thanks! It don’t make me time wasting!
Thank you. Thank was really annoying.
muchas gracias
De nada.
awesome 🙂
Thanks !
Worked like a charm. Thank you!
Just adding my thank to the pile 🙂
thanks a lot , your solution works well 😀
Merci beaucoup. It help me a lot.
Really thak you!!
Thank you very much. It help me a lot.
thank you brother!!!
👊😎
it help me a lot but after this solution i am facing count () function is not working with group by . hosting to Digital Ocean Droplet where
OS is Ubuntu 18.04,
Apache2,
PHP 7.2,
Tomcat 9,
MySQL 5.7 ,
PhpMyAdmin 4.8.
but same program is working in another hosting (not VPS) which is running.
will you give me guideline ?
If you are getting more errors, I would suggest upgrading to the latest version of phpMyAdmin
See: How to Manually Upgrade phpMyAdmin
it help me a lot.
great
🙂
Thanks.
👍
Thanks! It works perfectly.
Cool 🙂
Thx ! It works 😉
😎
Thanks it does the work.
Great!
perfect
👍
I seem to have errors in phpmyadmin. I get Warning in ./libraries/plugin_interface.lib.php#551 under import and export tabs. I have done above 🙁
Backup
plugin_interface.lib.php
Edit
plugin_interface.lib.php
Press
CTRL
+W
and search forReplace with
Save file and exit. (Press
CTRL
+X
, pressY
and then pressENTER
)I ended up taking a complete back flip. I worked out what i did wrong. I set up the database users incorrectly and wouldn’t connect. I ended up using a raspberry pi instead of laptop. Easier to make backups or repair if it goes down. I have found your posts very handy. thanks
🙂
if not found:
if (! is_null($options) && count($options) > 0) {
please search:
if ($options != null && count($options) > 0) {
and … It works.Hi, thanks for the article and this comment. When I tried this, the section of the screen is blank. There is nothing in the section that has the import options.
please try
if ($options != null) {
worked for me…thanks!
Cool 🙂
<3 worked for me <3
thanks!!! worked for me…
thanks
Carefull for some of us does changing this setting isn’t working, You get Blank Page, follow the steps @Ardhia Mangku Ikhsan Provided.
Thanks for the tip.
Thanks!
Works, you rescued me.
This worked on Ubuntu MacBook Pro. Thanks!
Saved my day too: tnx.
🙂
saved my day. thanks!
👍
🙂 worked like a charm 18.04 7.2 cheers
Super 👍
Perfect
👍
Hi, solution in sql.lib.php is perfect. Thanks.
Great! Hopefully the repositories will update with the latest version of phpMyAdmin soon.
Error in processing request
Error code: 500
Error text: Internal Server Error
1, I get this error when selecting a table and query in Phpmyadmin.
2, Also My imported files are not in the db.
3, Export page in the created DB is blank.
Kindly help me to solve this issue.
Thank you in advance. Have a great day
Regards,
Sampath
try this, its work with to me:
sed -i “s/|\s*((count(\$analyzed_sql_results[’select_expr’])/| (\1)/g” /usr/share/phpmyadmin/libraries/sql.lib.php
Got from https://stackoverflow.com/questions/48001569/phpmyadmin-count-parameter-must-be-an-array-or-an-object-that-implements-co
sudo sed -i “s/|s*((count($analyzed_sql_results[‘select_expr’])/| (1)/g” /usr/share/phpmyadmin/libraries/sql.lib.php