Page 1 of 1

Execute an external program

Posted: Mon Feb 14, 2005 11:39 am
by phpfreak
i am trying to execute a .php file after a certain form is submitted. i tried to use exec and others but couldnt succeed; can anybody help me out.

Posted: Mon Feb 14, 2005 11:48 am
by feyd
to execute a .php file directly, you need a shebang (#!/usr/bin/php) as the first line.

what are you processing this form in? If php, why execute the script? Why not include it or redirect to it?

Posted: Mon Feb 14, 2005 12:11 pm
by phpfreak
what are you processing this form in? If php, why execute the script? Why not include it or redirect to it?
I am processing the form in php but i dont want to use include because
I want to keep it as a separate entity and also, it allows for setting permissions on that particular file.

I tried using "#!/usr/bin/php" but couldnt succeed. can you please help me in here

Posted: Mon Feb 14, 2005 12:21 pm
by feyd
did you remember to set execution permission on "others" ? or whatever php is being executed under..

Posted: Mon Feb 14, 2005 12:30 pm
by phpfreak
can you please give me an example as to how to write the code for it. It would be of great help

Posted: Mon Feb 14, 2005 12:32 pm
by feyd
there's no code you need for it, it's done once. Use your FTP client, if allowed, or your website control panel to set the permissions on the file to execution by the apache/php user (most likely 'nobody', so 'other' needs to be set)