ebnerjoh Posted June 14, 2017 Share Posted June 14, 2017 Dear all,  On my old Webserver I have a visualisation of my solar-system, based on PHP and MySQL. In addition to that I am running a PHP Script which sends me an email if a temperature value decreases below a threshold. On this server I also had Exim as Mail-Relay configured.  Now I want to port everything to UnRaid.  Therefore I Installed the MySQL Docker and the Apache Docker. So far the Website is up and running, but the Script for sending out the email is not working (/usr/sbin/sendmail: not found)  How could I get this resolved with UnRaid?  Br, Johannes    Link to comment
trurl Posted June 14, 2017 Share Posted June 14, 2017 You want the "notify" command: Â Link to comment
ebnerjoh Posted June 14, 2017 Author Share Posted June 14, 2017 Can I run this within a PHP-File within a Docker? Â Br, Johannes Link to comment
trurl Posted June 14, 2017 Share Posted June 14, 2017 14 minutes ago, ebnerjoh said: Can I run this within a PHP-File within a Docker? Â Br, Johannes Sorry. I see what you are trying to do now. You can't run commands on the host from a docker. Maybe you could get the docker to write a file to a folder on the host and use inotifywait on the host to trigger an email when it sees the file. Â Possibly you just need different docker that includes sendmail. Or you could docker exec into bash in the docker and install sendmail there. Any change you make to a docker like this will not persist if the docker is reinstalled. Â Maybe someone else will have a better idea. Link to comment
ebnerjoh Posted June 14, 2017 Author Share Posted June 14, 2017 So I could run my PHP Script within the Docker, doing the SQL Check and SQL Update.  But instead of sending an Email I could try to write a file into the docker.  Outside the docker I am monitoring the file and if there (either with cron or inotify) sending out the notification?  Br, Johannes Link to comment
trurl Posted June 14, 2017 Share Posted June 14, 2017 34 minutes ago, ebnerjoh said: So I could run my PHP Script within the Docker, doing the SQL Check and SQL Update.  But instead of sending an Email I could try to write a file into the docker.  Outside the docker I am monitoring the file and if there (either with cron or inotify) sending out the notification?  Br, Johannes Something like that. Of course, you would need to write the file to a folder that was in a volume mapping. I will leave the details up to you to figure out.  Or install sendmail in the docker. Here is how to get to a command line inside the container:  Link to comment
ebnerjoh Posted June 14, 2017 Author Share Posted June 14, 2017 I have also installed the LetsEncrypt-Docker. This docker seems to have sendmail installed. Â I uploaded the script to the docker, but when executing the script I am getting the following error: Â PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /config/www/email/check_temp_boiler.php:61 Stack trace: #0 {main} thrown in /config/www/email/check_temp_boiler.php on line 61 From my basic knowledge I would say that this docker is not able to use the php function "mysql_connect". Correct? Â Br, Johannes Link to comment
trurl Posted June 14, 2017 Share Posted June 14, 2017 2 minutes ago, ebnerjoh said: I have also installed the LetsEncrypt-Docker. This docker seems to have sendmail installed. Â I uploaded the script to the docker, but when executing the script I am getting the following error: Â PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /config/www/email/check_temp_boiler.php:61 Stack trace: #0 {main} thrown in /config/www/email/check_temp_boiler.php on line 61 From my basic knowledge I would say that this docker is not able to use the php function "mysql_connect". Correct? Â Br, Johannes I don't use any of this, but a quick google says mysql_connect is deprecated. Link to comment
Squid Posted June 14, 2017 Share Posted June 14, 2017 Quote http://php.net/manual/en/function.mysql-connect.php Quote Warning This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include: mysqli_connect() PDO::__construct()  Link to comment
ebnerjoh Posted June 14, 2017 Author Share Posted June 14, 2017 Thanks,  this was a big help but I need to look in detail to it.  Last stupid question regarding sendmail. Do I need to configure (mailserver, username, password,...) sendmail within the docker or do I have to do it via the mail command in order to send an email via gmail?  Br, Johannes Link to comment
ebnerjoh Posted June 15, 2017 Author Share Posted June 15, 2017 Maybe, if too many workarounds are needed to get sendmail working I could go with a full blown vmware with debian (apache, php, exim or sendmail). Link to comment
ebnerjoh Posted June 17, 2017 Author Share Posted June 17, 2017 Hi,  I was able to solve my problem with the script.  1) moved from mysql to mysqli commands 2) using phpmailer to send directly from PHP via Gmail  Br, Johannes Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.