I have PHP Server Monitoring running on a Synology and after I upgraded DSM to version 6 the scheduled task running the status.cron.php stopped working. On the command line (SSH) I get the following error:
unable to establish database connection
The website itself still works fine and manually "Update" works fine too.
Does anyone has the same problem and managed to solve it?
Thanks in advance.
Dennis
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have the same issue. The problem is that cron run php script in comand line where is another configuration for php. php.ini which is used in command line doesn't have mysql modules and others which are needed.
So in my case was solution to change cron script:
/volume1/@appstore/PHP5.6/usr/local/bin/php56 /volume1/web/phpservermon/cron/status.cron.php
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just installed the latest 3.3.1 release and reconfirmed the connection issue for my system (and turns out it has nothing to do with Synology). Here's the full working code containing the fix -
As per the comment in the code, the hostname 'localhost' is treated differently by the PDO connection code and will cause an error. Since other's posting in this thread are also using Synology, I'm assuming they also specified ' localhost'.
Hello,
I have PHP Server Monitoring running on a Synology and after I upgraded DSM to version 6 the scheduled task running the status.cron.php stopped working. On the command line (SSH) I get the following error:
unable to establish database connection
The website itself still works fine and manually "Update" works fine too.
Does anyone has the same problem and managed to solve it?
Thanks in advance.
Dennis
Hi,
I have the same issue. The problem is that cron run php script in comand line where is another configuration for php. php.ini which is used in command line doesn't have mysql modules and others which are needed.
So in my case was solution to change cron script:
/volume1/@appstore/PHP5.6/usr/local/bin/php56 /volume1/web/phpservermon/cron/status.cron.php
Many thx !!!! I had the same issue.
I am using now the symlink /usr/local/bin/php56 and it works fine.
ls -la /usr/local/bin/php56
/usr/local/bin/php56 -> /var/packages/PHP5.6/target/usr/local/bin/php56
So: /usr/local/bin/php56 /volume1/web/phpservermon/cron/status.cron.php
Thanks for that, very helpful.
Thanks, that helped me also out to get the cron running very quickly!
Anyone tried this with PHP70 ?
Attempted myself, but getting the same "Unable to establish database connection"
PDO MySQL is enabled in web station for PHP70
/volume1/@appstore/PHP7.0/usr/local/bin/php70 /volume1/web/monitor/cron/status.cron.php
I've enabled debugging and now I see this error in the logs..
Warning: MySQL connection failed: could not find driver in /volume1/web/monitor/src/psm/Service/Database.php on line 525
I have exactly the same problem. I will be so grateful if someone figures out how to fix this.
Okay, I managed to fix the connection in Database.php -
Code before:
New code:
Not sure if this will affect the cron job's Db connection as well, but it got the front-end working again at least.
Just installed the latest 3.3.1 release and reconfirmed the connection issue for my system (and turns out it has nothing to do with Synology). Here's the full working code containing the fix -
As per the comment in the code, the hostname 'localhost' is treated differently by the PDO connection code and will cause an error. Since other's posting in this thread are also using Synology, I'm assuming they also specified ' localhost'.
Reference: http://php.net/manual/en/pdo.connections.php
Also, apparently Unix sockets are faster than TCP/IP, so this could be a good fix for larger installs. :)