I am trying to run my legacy setup which used to work earlier. The script starts without the problem. Permissions should be fine. The problem is the script and the web based gui can detect each other. When I kill the script with Ctrl+C I see that it is always hanging in the following place:
Jan 10 2019 00:43:57 Controller debug message: INFO MESSAGE 2: Sensor initialized: pin 15 28A4D7AD0900002B null
Jan 10 2019 00:43:58 Controller debug message: INFO MESSAGE 2: Sensor initialized: pin 15 28A4D7AD0900002B null
Jan 10 2019 00:43:59 Controller debug message: INFO MESSAGE 2: Sensor initialized: pin 15 28A4D7AD0900002B null
^CTraceback (most recent call last):
File â./brewpi.pyâ, line 455, in
conn, addr = s.accept()
File â/usr/lib/python2.7/socket.pyâ, line 206, in accept
sock, addr = self._sock.accept()
KeyboardInterrupt
It seems to me they cant establish a socket communication between them. Any idea what might the problem be. I am using a PC under ubuntu instead of Pi.
I just saw this somewhere ⌠thereâs a note in socketmessage.php I think about uncommenting a line implementing php_sockets.dll through php.ini. Maybe? If Iâm remembering correctly.
This is also correct: brewpi-script git:(legacy) â ll total 308K -rwxrwxr-- 1 nexy nexy 3.0K Jan 10 00:55 autoSerial.py -rwxrwxr-- 1 nexy nexy 3.2K Jan 10 01:00 autoSerial.pyc -rwxrwxr-- 1 nexy nexy 6.3K Jan 10 00:55 backgroundserial.py -rwxrwxr-- 1 nexy nexy 5.8K Jan 10 01:00 backgroundserial.pyc srwxrwxrwx 1 nexy nexy 0 Jan 11 07:47 BEERSOCKET
It has rwx permission. I am running this on Ubuntu on my PC. I am wondering if there is any prevention for apache user so that it cant access freely everything except /var/www/html.
I apologize ⌠I think I read âPCâ as âWindowsâ and thatâs why I posted what I did.
Assuming you are running as âbrewpiâ and have not changed a bunch of things at once, it looks as if your permissions and ownership are not consistent with a default setup:
pi@brewpi:/home/brewpi $ ls -al
total 320
drwxrwsr-x 8 brewpi brewpi 4096 Jan 11 05:u7121:
drwxr-xr-x 4 root root 4096 Jan 8 09:09 ..
-rw-rwxr-- 1 brewpi brewpi 2971 Jan 8 09:09 autoSerial.py
-rw-rwxr-- 1 brewpi brewpi 6410 Jan 8 09:09 backgroundserial.py
srwxrwxrwx 1 brewpi brewpi 0 Jan 11 05:21 BEERSOCKET
You might try to run fixPermissions.py in the utils directory. While BEERSOCKET is rwx for world, one of the other scripts might not be reading properly. As Elco said, /var/log/apache2 often show us whatâs happening. Thatâs been the source for me figuring out a lot of mistakes Iâve made.
Nothing in apache2 error log except debug prints i added. This is not assumed as a problem because if u cant access the socket it means the script is not running. PHP scripts always die with info which is shown in the web page. I believe the problem is in some apache config. Maybe raspbian distro is different in the sense of security.
So, I played a little bit and changed the source code to make a socket inside /var/www/html and it works now. I will update the final answer as soon as I get the answer from stackoverflow.
Are the group memberships correct? brewpi should be a member of www-data, brewpi:brewpi should own script path and www-data:www-data should own /var/www/html
Yes, this is everything correct. Another point, when i changed the user fir apache everything worked. I am quite sure that apache restricts access to arbitrary folders on the machine.