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?

Recommended Answers

All 3 Replies

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.

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:

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.