exe problem again

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

exe problem again

Post 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.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: exe problem again

Post 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.
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: exe problem again

Post 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.
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: exe problem again

Post 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
User avatar
The_Anomaly
Forum Contributor
Posts: 196
Joined: Fri Aug 08, 2008 4:56 pm
Location: Tirana, Albania

Re: exe problem again

Post 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?
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: exe problem again

Post by susrisha »

The_Anomaly wrote:
Basically, can you switch to a non-shared hosting plan?
I didnt understand this :dubious: Lack of knowledge :mrgreen:
User avatar
The_Anomaly
Forum Contributor
Posts: 196
Joined: Fri Aug 08, 2008 4:56 pm
Location: Tirana, Albania

Re: exe problem again

Post 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 :(
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: exe problem again

Post 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 ;))
User avatar
The_Anomaly
Forum Contributor
Posts: 196
Joined: Fri Aug 08, 2008 4:56 pm
Location: Tirana, Albania

Re: exe problem again

Post 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?
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: exe problem again

Post by susrisha »

yes i can ssh to the server.
User avatar
The_Anomaly
Forum Contributor
Posts: 196
Joined: Fri Aug 08, 2008 4:56 pm
Location: Tirana, Albania

Re: exe problem again

Post 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.
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: exe problem again

Post 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 .
User avatar
The_Anomaly
Forum Contributor
Posts: 196
Joined: Fri Aug 08, 2008 4:56 pm
Location: Tirana, Albania

Re: exe problem again

Post 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.
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: exe problem again

Post 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. ;)
User avatar
The_Anomaly
Forum Contributor
Posts: 196
Joined: Fri Aug 08, 2008 4:56 pm
Location: Tirana, Albania

Re: exe problem again

Post 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.
Post Reply