Page 1 of 1
Unable to create file using exec()
Posted: Thu Oct 16, 2003 4:43 pm
by catchkasi
Hi all,
I tried to run an executable file (which creates few files) from php using exec() function of php. But it does not create the files. What could be the problem?
Thanks,
Kasi
Posted: Thu Oct 16, 2003 5:15 pm
by Gen-ik
I take it the .exe file is on the server?
Posted: Fri Oct 17, 2003 11:33 am
by catchkasi
Yes its in the server. I would like to add that I am able to create files from php directly.
Thanks,
Kasi
Posted: Fri Oct 17, 2003 11:37 am
by markl999
Problems with using system functions such as exec() usually comes down to either paths or permissions.
So try using the full path to the executable and also check it has sufficient permissions.
Also, if you're using *nix then you can easily find out what's wrong by doing 'su - apache' (or whoever the web server is running as) and run the exact same command you use in the exec(). .. this requires root access too though.
Posted: Mon Oct 20, 2003 1:36 pm
by catchkasi
The path is not the problem as I can run other executable that dont open or create files. Also I am working in Linux, so could you explain how I could check whatz happening when I run exec() function.
Thanks,
Kasi
Posted: Mon Oct 20, 2003 1:39 pm
by markl999
You could 'su - apache' (or whoever the webserver runs as) and run the script that creates the files as that user.