Synology, PHP, and the mysql Extension

This week I installed a few new items on my Synology NAS server so that I could better familiarize myself with PHP and MySQL. The items I installed were:

  • phpMyAdmin
  • MariaDB (Synology no longer packages MySQL with DSM)
  • WebStation

I am running DSM 6.1.6 and PHP 5 and 7 were already installed and running on my server. I had written a simple connection script in PHP that was working on my remote web server but I could not get it to work on my Synology box. I kept getting a 500 error message. I even downloaded MAMP, configured it, and installed my test files and managed to get them working okay. I uninstalled and reinstalled the three items above numerous times over several days without any success. I tried changing the configurations a number of time also without any success.

I wrote and installed a simple script to call phpinfo() and noticed that the mysql extension was missing. I looked at the PHP section for WebStation and could not find any configuration settings for it.

After considerable searching via Google, I finally stumbled upon this excellent blog post by Frank Van Egmond concerning php, the current version of DSM, and mysql extension:

Of course these things happen at the most inconvenient of times. Since I did not want to present visitors to the webpage with an HTTP ERROR 500 I decided to give Google a try and search for the error. Unfortunately it seems to be the most common error you can find so the resolution is not dictated and spelled out for you. However some peoples PHP Extensions seems to have been messed up by the DSM upgrade so I decided to give look at my PHP settings first.

In my case where I use PHP 5.6 it seems the update messed with my PHP extensions. As you can see the “mysqli” extension checkbox is unmarked. Since WordPress makes use of the “MariaDB” database which is a fork of MySQL all started to make sense now.

Just re-enable the extension, click “OK”and presto! You should be able to give your website a go again!

I was excited because this was the first piece of information that seemed to finally make sense as to why my server was not working for me. However, when I went back to the PHP setting page in Web Station I did not see the information that Frank was describing. Frustration ruled again!

I continue to search for “missing PHP extensions Synology” on Google and finally found this page which show how the Extensions section was there but on a smaller laptop screen it is totally hidden and there are no scroll bars for you to be able to see it.

When I took my MacBook Pro and connected it to my Thunderbolt Display with higher resolution I was able to resize the window and see the hidden extensions section.

I clicked on the checkbox for mysql extension and then restarted my server and after some configuration changes in my file, everything started working.

I took the time to write this post with the hope that it might save some others the time and frustration that I experienced trying to resolve this. It seems like poor design on Synology’s part for this particular DSM UI. Hopefully they will fix this in an upcoming release for DSM.

3 comments:

  1. Well OMG – thank you my friend! Your post DID in fact help me solve exactly the same issue!
    As an edit, you CAN resize that window enough to be able to see the extensions below, but you would never know to look there without your post!

    So thank you, and thank you for writing the post.

  2. Thank you very much for your contribution, the key is probably to restart the service.

    Best regards,
    Christian

Leave a Reply

Your email address will not be published. Required fields are marked *