On 1/27/13, Ashley Sheridan <ash@xxxxxxxxxxxxxxxxxxxx> wrote: > On Sun, 2013-01-27 at 03:45 -0600, tamouse mailing lists wrote: > >> On Sun, Jan 27, 2013 at 3:10 AM, jupiter <jupiter.hce@xxxxxxxxx> wrote: >> > Hi, >> > >> > I have a client.php which calls an external python socket client >> > program exec("Client.py"), the Client.py calls >> > sockobj.connect(("localhost", 60000)) to connect socket. >> > >> > If I run the client.php from Linux command line $ ./client.php, it >> > works find, no problem at all. >> > >> > But when I run it from web page http://localhost/client.php, it could >> > not connect to socket at following exception in python >> > sockobj.connect(("localhost", 60000)): >> > >> > "sockobj.connect Errno 13 Permission denied" >> > >> > Why it can run from command line, but cannot make socket connection >> > from web? Does it need some kind of configuration in php or apache? >> > Appreciate any tips and clues. >> > >> > Thank you. >> > >> > Kind regards. >> > I am puzzled by >> >> First question: why use a separate program and language to call a >> socket? PHP has two ways of doing it, using the Socket extension and >> using the Stream extension. The Stream extension is a little nicer as >> you just use standard PHP file functions on it. >> >> To look here, though, you might want to look at the permissions on >> client.py to make sure it as well as the requisite paths to get to the >> script are readable and executable by the user running your webserver, >> or alternatively, your php scripts if running something like fcgi. >> > > > I'll take a bet that the Apache server is running as a different user > from your login, and doesn't have permissions to open sockets. You could > either give the Apache user permissions, or put the exec call as part of > an argument of sudo. Well, it is apache for both user id and group id if you are running from web server. The problem is not which user account, I can run it without any problems from command line in any user accounts, the problem is it got permission denied when you run from web server. > Thanks, > Ash > http://www.ashleysheridan.co.uk > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php