Almost all my new WordPress installations are now migrated to PHP 7, thanks to easyengine. Managing sites with nginx got so much easier with easyengine.
Just today I noticed that my blog isn’t running PHP 7, rather it was running on PHP 5.6, bummer! After realizing, quickly I logged-in to the server via SSH and upgraded easyengine and ran this command ee site update tareq.co --php7
. Yeah, it’s that easy.
But now comes main part, I was getting 500 error, Woot! Checking into error_log, nothing was there. After turning on `WP_DEBUG`, it exposed my MySQL connection credentials with saying, Call to undefined function mysql_connect()
. But after checking in, I had MySQL installed and I could login into MySQL console. But now with get_loaded_extensions()
, only the mysqlnd
extension was loaded, no `pdo_mysql` or `mysqli` extension was there. Typing `apt-get install php-mysql` didn’t solve, also `apt-get install php7.0-mysql` didn’t either. What the hell was going on?
After going in `/etc/php/7.0/fpm/conf.d` directory, this is what I found:
Ah, finally! Broken symlinks, Lets fix this. Firstly, remove the broken ones:
cd /etc/php/7.0/fpm/conf.d/ rm 20-mysqli.ini rm 20-pdo_mysql.ini
Now, correct the symlinks:
ln -s /etc/php/7.0/mods-available/mysqli.ini 20-mysqli.ini ln -s /etc/php/7.0/mods-available/pdo_mysql.ini 20-pdo_mysql.ini
…and restart the PHP and nginx. For Easyengine, this is as easy as ee stack restart
and voila! Alternatively you could run service php7.0-fpm restart
and service nginx restart