0

I wrote a following short script in PHP:

<?
$s = socket_create(AF_UNIX,SOCK_STREAM,0);
socket_connect($s,"/tmp/tmpsock");
socket_write($s,"test");
socket_close($s);
>

I user this code to connect to a simple server that prints everything it receives onto terminal output.

The script works fine when I opened it from terminal using php index.php, however I want it to be a part of a webapp, and I try to run it on apache2 server opening the index.php page in web browser (on server of course). The script doesn't work then - the socket_connect function returns nothing, the error description is "Success()" and the message doesn't appear on server. I use Ubuntu 16.04, Apache 2.4 and PHP 7.0

fqrt
  • 21
  • 2
  • Does the user who the PHP script is executing as under Apache (maybe apache, httpd, noboby, someone else) have permission to write to /tmp/tmpsock ? – Dom Nov 15 '16 at 00:59
  • Thanks! That was the answer, thank you! It didn't. – fqrt Nov 15 '16 at 15:47

0 Answers0