Hi,
I have a php web page. I need to run a C program which creates a socket and sends an IP packet to another machine. The C program is working fine.
I am using the exec command in my php script to run this program from the script. But the problem is when I run this script on the shell by giving sudo php<filename> , it runs fine and send the ip packet. But when I run it in a browser, the c program is not being run. I think it is a problem with some permissions. When I checked the error log I get the message, Error creating socket. But it runs fine without any errors from the shell. Please help me regarding this.
Running a socket C prrogram
Moderator: General Moderators
-
kollurivamsy
- Forum Newbie
- Posts: 1
- Joined: Mon Nov 10, 2008 11:53 pm
Re: Running a socket C prrogram
Yhat's because you execute the socket program unser Apache user permissions.
Two solutions:
1) Create a socket with port number > 1024, so no root access is required;
2) Use properly configured sudo - i.e. grant sudo to Apache user, so it could create a socket with port number < 1024.
Two solutions:
1) Create a socket with port number > 1024, so no root access is required;
2) Use properly configured sudo - i.e. grant sudo to Apache user, so it could create a socket with port number < 1024.
There are 10 types of people in this world, those who understand binary and those who don't