0

hi

I have this problem using "system" function :

I am using "system" function to run a program form php script , this program is supposed to run another program , but that doesn't happen at all , the program is functioning when it's run form outside php but it's not when run using "system function , anyone can help?

2
Contributors
3
Replies
4
Views
11 Years
Discussion Span
Last Post by Troy
0

I always use the exec() function instead of system(). I'm not sure what's different about them.
http://www.php.net/manual/en/function.exec.php

The most likely problem is that the user account that the webserver is running as does not have privs to execute the command or script. For example, since my Apache webserver runs as the user wwwrun, and the apache restart command can only be run as root, I can't have my PHP app do "exec("/usr/bin/rcapache restart");

If you are working with a Linux server, and it is safe to do so, you can chmod the script you want to run using a command like 'chmod 777 myscript". Make sure you are not creating a security hole by doing so.

0

My problem is not in "system" or "exec" functions , when I use "system" or "exec" to run a program then it's successfully run but it doesn't do its job which is running a third program , by the way I am using Apachi on windows , can anyone help :sad:

0

Have you verified that the Windows user that Apache is running as has the privileges to execute the third program you are trying to run.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.