I am using exec function in a php script, if I run the script in command line, such as “php xx.php”, the exec function will be executed, but if i access the php page from a browser, then the exec function will not run. Anyone known how to solve the problem?
Thanks.
Is the script trying to create/edit/delete files? Try making the files and the containing directory writeable by the web server. If you’re trying to add a file, navigate to the folder you’re adding it to and run the following:
chmod go+w .. If you’re trying to delete/edit a file, trying the following:chmod go+w myfile.txt.When running a script from the command line it runs as the logged in user, whereas when running it through a browser it is run as the web server user (usually a user named www.) This user generally doesn’t have write access to the files and directories that are being served.