shell_exec problem

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
ZicoBarton
Forum Newbie
Posts: 4
Joined: Sun Aug 12, 2007 11:30 am

shell_exec problem

Post by ZicoBarton »

Hi all,
not sure if this is the correct place to post this question but here goes.

I am trying (and failing) to execute a command line program with the php function shell_exec.

Some commands work, dir for example is fine and shows me all the files in that directory.

I have image magic installed on the server which, when run from a command prompt via remote desktop connection, works fine.
But when I run the same command using the shell_exec function it doesn't work. I don't get an error or anything, the output file just isn't created.

I really want to get ffmpeg running, but when i try to use this progam via shell_exec I get a "502 - Bad Gateway" error.

Again, the same command using remote desktop connection it works fine.

The server is running Windows 2003 server, and I dont know if its a PHP problem (maybe a config problem) or a server problem (permissions perhaps?).

If anyone has any ideas I'd appreciate a reply.
Thanks
Zico
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

sounds more like a permissions problem.
ZicoBarton
Forum Newbie
Posts: 4
Joined: Sun Aug 12, 2007 11:30 am

Post by ZicoBarton »

Thanks for the quick reply.

I have tried setting the permissions on the executable (ffmpeg.exe) but I wasn't sure which user to give access to it.
As a test I have the user group 'Everyone' full access, but this hasn't worked.

Do you know who I should give access to, what level of access I should give them and what do I give them access too (ie the executable only, or the entire directory)?

Thanks
Zico
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Is it possible that ffmpg is trying to interact with the desktop? (As a network service does not and should not allow that)
ZicoBarton
Forum Newbie
Posts: 4
Joined: Sun Aug 12, 2007 11:30 am

Post by ZicoBarton »

I don't think so no.
When I run it from a command prompt on the server no windows are loaded for either ffmpeg or image magic.
Although that's not to say it inst loading a 'hidden' window?
ZicoBarton
Forum Newbie
Posts: 4
Joined: Sun Aug 12, 2007 11:30 am

Post by ZicoBarton »

There havnt been any replies for a couple of days now so I am assuming no one has an easy answer?

Does anyone know what permissions I should set to run a shell_exec command?
e.g. Full Access, Read Only etc.
Also what user do I allow access?

Should I set the permissions on the exe I am trying to run, the entire directory or cmd.exe?

Thanks again for your help.
User avatar
stereofrog
Forum Contributor
Posts: 386
Joined: Mon Dec 04, 2006 6:10 am

Post by stereofrog »

Try running your command with 2>&1, perhaps you get a meaningful error message.

As for permissions, IIRC on windows you have to go to Start - Settings - Services (or similar), double-click Apache service and select your own account on the "login" tab (assuming this is your local test server and security is not a concern).
Post Reply