tags:

views:

58

answers:

2

I was executing ffmpeg from php running inside apache. I used to get the error " error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory".

It used to work perfectly if the php script was executed from the command prompt or ffpmeg was directly invoked from the command prompt.

I followed the below steps to fix the apache error:

Step 1: Check if the file “libavdevice.so.52″ exists in the server using the following command.

find / -name ‘libavdevice.so.*’

Step 2: You will get the directory in which the file “libavdevice.so.52″ exists from the above command. Suppose the directory is “/usr/local/lib/” in this example.

Step 3: You have to add the directory name in the file “/etc/ld.so.conf”.

Step 4: Execute the command “ldconfig”.

How did doing the above make a difference to apache?

+1  A: 

If you are experiencing command prompt vs php problems I would maybe look into file execution permissions. www-data (or whoever PHP is running as) is what permission FFMPEG will assume when executed by PHP.

I haven't run into this exact problem in the past, but it is one place I would suggest you try looking since it runs correctly from CLI.

angryCodeMonkey
Thanks for that. Btw, the issue is resolved with steps I mentioned but I want to know as to how did it make a difference to apache. Btw, I had checked file permissions and it was for all(777).
foobar
A: 

I don't quite get the question, it seems to answer itself to me.

You did 3 steps, and the only thing you did there that could have affected apache is editing /etc/ld.so.conf. I don't know if it did (I have no idea what that file is) but if in a remote case it didn't, it surely was some background process. find and ldconfig won't affect apache in anyway.

Cawas