Page 1 of 2

exe problem again

Posted: Thu Mar 12, 2009 2:59 am
by susrisha
I have a local ffmpeg.exe which i tried to invoke using a php script

Code: Select all

 
 
$cmd = "ffmpeg";
echo "Command $cmd";
echo"RETURNED VARIABLES : <br />";
exec($cmd,$return_var);
print_r($return_var);
 
Now if i run this on the local machine, it gives me an output correspondingly. My system is running on Windows XP
I have uploaded both the exe file as well as the same script to my hosting site which runs on Linux.

When i run the same code there, it shows an empty array.

Q1. Are there any settings required for the php script to execute a shell command?
Q2. Is it the compatibility issue?(Linux/Windows changeover).

Please help me with this.

Re: exe problem again

Posted: Thu Mar 12, 2009 3:38 am
by requinix
You can't run Windows programs directly on Linux. Get the ffmpeg version for Linux instead.

It should come with instructions on how to use it. Follow them.

Re: exe problem again

Posted: Thu Mar 12, 2009 4:27 am
by php_east
a windows shell is not the same as a unix shell and is not the same as a mac shell.
exe codes are OS dependent.

which is why they are not used for the internet. people like java and flash have to make plugins for every OS.

Re: exe problem again

Posted: Thu Mar 12, 2009 4:48 am
by susrisha
Well i tried a simple helloworld program that i wrote in linux and tried to exec the same in the hosting server. No output. Further querying the host, came the big bang answer in one line.
We do not allow for external binary's of any kind to be ran on the server.
Haha . now i am in hunt of a design as to how to get the work done?

Any designs are welcome. Basically this is what i want to be done.
1. The file to be uploaded
2. I need to convert the file to flv format
3. Add some key frames in the flv
4. Store it in another folder and delete the original uploaded file.

2 and 3 involve ffmpeg commands for which i needed ffmpeg to be run. i am considering to do it remotely and again upload the converted file using ftp upload. Any designs on that are welcome..
Thanks for the feed back

Re: exe problem again

Posted: Thu Mar 12, 2009 5:08 am
by The_Anomaly
If you do some searches for ffmpeg on here, you'll find that I've opened several threads about this kind of thing. I spent a great deal of time suffering with getting ffmpeg to do my bidding, but once you get it working, it's really amazing.

Basically though, you need a VPS or your own server. No hosting provider I know of will allow you to install applications on their servers. There are some hosts I believe who are media oriented and already have ffmpeg preconfigured, but in my case, I just got a VPS from EasyCGI, and worked with that.

I use only Linux servers, despite the fact ffmpeg was ported to windows. As others have said, you really can't use a Windows executable on a Linux server without much unnecessary pain. Besides, it's extremely easy to get the linux build, and probably works better anyway.

Basically, can you switch to a non-shared hosting plan?

Re: exe problem again

Posted: Thu Mar 12, 2009 5:20 am
by susrisha
The_Anomaly wrote:
Basically, can you switch to a non-shared hosting plan?
I didnt understand this :dubious: Lack of knowledge :mrgreen:

Re: exe problem again

Posted: Thu Mar 12, 2009 5:25 am
by The_Anomaly
Shared Hosting and Virtual Private Server Hosting.

Shared hosting means that you share your server with a bunch of other people, don't have shell access, can't execute programs, can't change your php.ini, and have very limited control. Virtual Private Servers, on the other hand, are almost like your own dedicated server, just less expensive/poweful. You still share it with others, but you have far more power, and you can execute programs like ffmpeg, and basically do anything you would do if it was a box sitting next to you.

Of course, VPS's are more expensive though :) You can always use them for multiple sites though, as with any server.

EDIT: ...yeah. The above links stopped working. Nothing is more comforting than when your hosting company can't keep their own website's servers working :(

Re: exe problem again

Posted: Thu Mar 12, 2009 5:30 am
by susrisha
i dont think my host provider will have shared hosting. but again, that other server needs to have access to run the programs right? am sorry if i am wrong. but where would i have to find the other server?

PS: The given links timedout. not working ;))

Re: exe problem again

Posted: Thu Mar 12, 2009 5:31 am
by The_Anomaly
susrisha wrote:i dont think my host provider will have shared hosting. but again, that other server needs to have access to run the programs right? am sorry if i am wrong. but where would i have to find the other server?

PS: The given links timedout. not working ;))
See my edit.

And you want a VPS/Dedicated. You currently most likely have shared. Can you RDC or SSH into your server?

Re: exe problem again

Posted: Thu Mar 12, 2009 6:18 am
by susrisha
yes i can ssh to the server.

Re: exe problem again

Posted: Thu Mar 12, 2009 6:26 am
by The_Anomaly
Then install ffmpeg via ssh. I think there's an apt package for it.

try

Code: Select all

sudo apt-get install ffmpeg
If not, download the source and build it.

Re: exe problem again

Posted: Thu Mar 12, 2009 7:00 am
by susrisha
In case you have forgot, the host provider doesnot allow me to run any executable files on the server. Which means even if i install the ffmpeg by some means, i wont be able to run it .

Re: exe problem again

Posted: Thu Mar 12, 2009 10:21 am
by The_Anomaly
You only said that you couldn't run your windows exe, which is natural, as you have a linux server. That's not them banning you, that's just that you can't run .exe files on a linux server.

If you actually have SSH access, I'd be very surprised if they don't let you run shell commands from your application.

Re: exe problem again

Posted: Thu Mar 12, 2009 10:56 am
by susrisha
no the hosting party doesnt allow <b>any</b> kind of binarys to run on the server. Have tried also. Created a simple helloworld program in linux and uploaded it to the server. Tried to execute it through php but no result. ;)

Re: exe problem again

Posted: Thu Mar 12, 2009 10:59 am
by The_Anomaly
Is safe mode enabled? It certainly was initially on on my VPS, which caused a great deal of wonder as to why exec() wasn't working.