title: How can I connect to a mysql server from a php page using Synology?
body: <p>I have an older Synology device (DSM v5.2-5967 Update 4, phpmyadmin v4.4.7-0103) that has some local websites with working php pages. I want to migrate this over to my new Synology device (DSM V6.1.3-15152 Update 1, phpmyadmin v4.6.6-0172). When installing the new version of phpmyadmin from Package Center, I am required to download Maria DB and PHP 5.6 as well, whereas this is not a requirement in DSM 5. Further, DSM 6 now supports options in Web Station, where I can configure the http back-end server and PHP version. I set this to 5.6, the one installed alongside phpmyadmin.</p>
  
  <p>Here is the code that used to work for me in the old DSM:</p>
  
  <pre><code>&lt;?php
  define ("DB_HOST", "localhost"); // Your database host name
  define ("DB_USER", "root"); // Your database user
  define ("DB_PASS", ""); // Your database password
  define ("DB_NAME", "groceries"); // Your database name
  
  $link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make connection.");
  $db = mysql_select_db(DB_NAME, $link) or die("Couldn't select database");
  ?&gt;
  </code></pre>
  
  <p>This code now returns "Couldn't make connection". Other sites that don't handle this return a 500 server error. I've tried replacing localhost with the name of the Synology device, to no avail. PHP files themselves work fine but I cannot connect to a database. I cannot see the control panel for Maria DB anywhere, so I don't know if I'm missing any settings. This is a new device, with a fresh install of packages so I haven't even changed the root password yet.</p>
  
  <p>I even tried installing Apache 2.4 from Package Center, and setting that as the back-end server in the new Web Station settings, and rebooting the NAS. But phpyadmin still shows "nginx/1.11.10" as the web server. For reference, my old NAS shows Apache under web server, but I don't have the Apache package installed.</p>
  
  <p>I'm at a loss. Has anyone tried to connect to a mysql database using Synology DSM 6 and lived to tell the tale?</p>