I am using ffmpeg on Mac OSX 10.7.3 in MAMP through PHP's exec() command, I have an absolute path set to call ffmpeg, e.g.
/opt/local/bin/ffmpeg -i "/sample.avi"
But I receive the following error -
dyld: Library not loaded: /opt/local/lib/libjpeg.8.dylib Referenced from: /opt/local/lib/libopenjpeg.1.dylib Reason: Incompatible library version: libopenjpeg.1.dylib requires version 13.0.0 or later, but libJPEG.dylib provides version 12.0.0
N.B. ffmpeg was installed through Macports.
It works from the command line.
What to do?
EDIT
I've reopened this - originally thought shell_exec() solved the issue, but infact it should be called differently - and I didn't realise until investigating further today. Here is my code using shell_exec and still giving the error above:
$cmd = '/opt/local/bin/ffmpeg -h';
$cmd = escapeshellcmd($cmd) . ' 2>&1';
$output = shell_exec($cmd);
var_dump($output);
The problem is that the DYLD_LIBRARY_PATH is set in MAMP and I've installed ffmpeg via macports.
This might not be the best fix but it has me up and running for now:
In the /Applications/MAMP/Library/bin/envvars file and comment the following lines as below:
#DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
#export DYLD_LIBRARY_PATH
and restart Apache
Commenting out the line #DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH" will work in the short term but it could break other things, since you're removing the line that MAMP uses to tell the server where it keeps its libraries.
A better solution would be to change the line to this:
DYLD_LIBRARY_PATH="/usr/local/lib:/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
so that you're just prepending /usr/local/lib: to the already-given path. This tells Apache to look in /usr/local/lib first, and then if that doesn't work, to look in /Applications/MAMP/Library/lib.
So if you install something via, say, Brew and there are two versions, it'll look in the one you installed with Brew first, before it uses whatever came with MAMP, which is more likely to be out of date. But if it's something that only came with MAMP, that you didn't install separately or that is MAMP-specific, you won't break it.
Ensure PHP's exec is using the same shell as you, when you use the commandline.
Probably shell_execÂDocs helps.
See as well php shell_Exec not working while the command works in shell.
Related
I'm trying to install orocrm on centos server and it is asking for PHP 5.4 and ICU library 4.4. Although I updated PHP and restarted Apache my php version still shows PHP 5.3 if outputting phpinfo in a php page. But,if I use php -v command then it shows php 5.5
ini path is shown /usr/local/lib/php.ini if using php page but through command it shows /etc/php.ini
please help...
The PHP 5.4 you compiled is not getting picked up by Apache. Rather than figuring out how to point Apache to this installation, the easiest (and safer since you'll get security updates) is to use the IUS Community repository
I have a couple of thoughts. If you're on CentOS you're probably using YUM as your package manager. With it, you could remove the PHP's and add a new one (if you don't have active clients using it). You can search what PHP version yum has by doing one of these:
yum list
yum list installed
If it registers multiple versions, you can "yum remove $package".
If you're php -v showing version 5.5, then your path is set to include that. You can see that by typing $PATH from the command line when SSH'd in. In your ~/.bashrc (or ~/.profile) you can edit your $PATH by adding something like:
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
EDIT: You should back up your PATH before writing a new one and after you edit it type "source ~/.bashrc" or "source ~/.profile" to make the command line see it.
You can also directly edit the php in the .bashrc to point to the correct version by setting up an alias (if you don't fix the root of the problem) like
alias php="/path/to/php"
You can see where your current php is by typing:
which php
Your PHP extension comes from the apache httpd.conf file. You can find it somewhere like /etc/apache2/httpd.conf. Search for "LoadModule" or "LoadModule php" and see which extension of PHP your apache is pointing to. It may still be pointing to an incorrect version.
To answer your question about ICU, it comes from the "intl" extension. With yum, this is probably called php-intl or php54-intl or php54w-intl. You can do something like "yum search intl" and it should give you the exact extension name.
I hope this helps!
After I tried for hours to find the good path for PHP-CLI, i finally found it. But my proud was soon gone again.
Still i got the following error:
The following requirements were not met. As a result video uploads have been disabled.
Unable to locate path to PHP-CLI
I have tried much different paths
bin/php
usr/local/lib
usr/local/lib/php
usr/local/bin/php (this is the good one I thought).
Still getting the same error as above. Whats happening? My server is not running in Safe Mode and my exec() are enabled via the php.ini file.
Please help me..
Edit:
Paul
Q: Have you tried any "fully qualified paths", e.g. "/bin/php" (not
just "bin/php")?
A: I have tried both solutions, no result.
Q: Are you sure php-cli is installed on your system (it's typically a
seperate package from the Apache PHP plug-in)? EXAMPLE: apt-get
install php5-common libapache2-mod-php5 php5-cli.
A: I tried this in the SSH of my server, its a CentOS server so he didn't found the comment
#Peter:
If you installed PHP through your OS package manager, the path would
probably be /usr/bin/php, which appears to be the only one you didn't
try
I tried that one now, i didn't help, still the same error:
Edit2
#Dev-null
You have found and what? Just knowing where >is located will not fix it, have you changed some >code or environment variable PATH to make it
A: its an input field where i need to put the path in. I haven't changed any code, because PHP version 5.3.17 (CLI) installed on my CentOS server. So no need to change some code just for the path, right?
Edit
My PHP info, PHP 5.3.17 (CLI) Check the image below..
Edit
When I do rpm -q php-cli I get PHP-CLI not installed and when I want to install i get No package php-cli available. See image below.
Edit
Result of /bin/php -v below.
CentOS ships the PHP command-line interpreter in the php-cli package. So you first need to verify whether it's installed or not:
rpm -q php-cli
If installed, you can list all its files:
rpm -ql php-cli
... and filter out potential binaries:
rpm -ql php-cli | grep /bin/
You can get further details in the Using RPM chapter of the deployment guide.
If the package is not installed:
yum install php-cli
More info at Installing New Software with yum.
All this answer assumes that nobody broke the package system by installing software manually. If that happened, there's no way to tell what changes were made to the system.
Edit #1: I've just seen your last edit where php-cli is up and running. Then, if you want to know the path you just need to type this:
which php
Edit #2: You seem to have up to 4 binaries called php in your path. I still think that the proper reliable way to find the php-cli binary is running rpm -ql php-cli but given that php finds it on the path I'm pretty sure that it's located at /bin/php and you can verify it by running:
/bin/php -v
Run that exact command—don't remove any slashes or append -cli.
If your script, whatever it looks like, cannot find it, it's either doing it wrong or it's missing the appropriate permissions.
try the following to find it:
sudo find / -name php-cli
You most likely want php instead of php-cli though.
None of the solutions on this page found the installed versions of PHP that were present in my own elusive search for php-cli. The solution for me was to use the following command:
locate bin/php
This listed all php versions and I could then replace php with, for example:
/usr/bin/php71-cli
To access the command line interface version of php rather than the default cgi one. I then alias my instructions like so:
alias composer='/usr/bin/php71-cli bin/composer.phar'
I installed "drush" for my drupal website.
when I tried to run "drush":
[root#server /]# drush
/usr/share/drush/drush.launcher: line 132: /usr/bin/php-cli: No such file or directory
[root#server /]#
php-cli was not in my default directory /usr/bin
Solution was to copy my "php"-file to "php-cli" file (no rename!!, just copy)
[root#server /]# cp php php-cli
weird, but still working!
When I attempt to run composer install in the CLI, I get this error:
You must enable the openssl extension to download files via https
The problem seems to be on line 5381 of my composer.phar file:
if (!extension_loaded('openssl') && (0 === strpos($url, 'https:') || 0 === strpos($url, 'http://github.com'))) {
throw new \RuntimeException('You must enable the openssl extension to download files via https');
}
I have enabled the openssl extension in both my php.ini files. (Apache and PHP)
If I run openssl version in the CLI it returns
OpenSSL 1.0.1c 10 May 2012
I ran the following PHP script through my WAMP server:
echo extension_loaded('openssl');
It printed 1
As far as I can tell, my openssl extension is working fine, but for some reason it is still causing this error for Composer.
Does anyone see any problems I may have overlooked?
There is a difference between PHP running inside a HTTP server, and on command line - both cases use their own configuration, so it might be that your command line version has not SSL extension configured.
Check for yourself: php -i shows you the phpinfo output on the command line. Any OpenSSL to be seen?
While you are at it, use the same output, locate the info on which php.ini is being used, and add the OpenSSL extension.
As you did not provide a lot of information, I just assume that your system setup (Windows XP, WAMP) is similar to mine. In principle this answer should work on Unix but I am not able to check it.
Anyway, I had PHP running on WAMP and I had set up the ini-files correctly but still I got the same error as you did. After doing some research and a lot of tinkering, I noticed that the PHP running on command line did not actually use any ini-files (command php --ini). After noticing that, I got composer running properly by setting the ini-file with php -c command.
Long story short, try this command php -c /path/to/ini/file composer install and see if it works.
Here is how I solved the problem while installing Composer. I had saved the php file to c:\php. In the php.ini file I opened the extension =php_openssl.dll by removing the semi colon with no success. i found the extension openssl.dll in the sub directory called ext . I copied it to the c:\php directory. I met with immediate success. What a hassle! Glad to move on.
I installed lighttpd, php5 +fastcgi, and php5-curl earlier this morning using MacPorts. I have been able to get the former two working fine, but I can't seem to get PHP to see the installed cURL extension. I did not change the install path for cURL - it is now at /opt/local/lib/php/extensions/no-debug-non-zts-20090626/curl.so.
I've added a line into my PHP file as well:
extension=curl.so
I've tried this line as well as one using the absolute path, restarting the server in between tries, but nothing has made cURL show up as an extension when I run a test page with phpinfo().
Am I missing a step here? Do I need to reconfigure and recompile PHP with an option for cURL, maybe?
Did you view the error message of Lighttpd? I guess there might be a problem with loading the curl.so, and it will be there.
I'm running XAMPP 1.7.3a on Ubuntu 9.10. With Netbeans 6.7.1 as my editor, I want to be able to debug my PHP sites.
To do this, I looked up Xdebug and started following the installation instructions, found here: http://xdebug.org/docs/install.
Trying to compile the .tgz file, run in to a problem.
Step 3) I can execute that, but what use does it have? I don't get the output or what I should do with it.
Step 4) I execute the following command:
./configure --enable-xdebug --with-php-config=/opt/lampp/etc/
At the bottom of the output, it says: configure:
error: Cannot find php-config. Please
use --with-php-config=PATH
I've checked the location I entered, the php.ini file is there and so are all other config files.
So, I'm not sure what to do now. Should I ignore and just do the 'make' command, or does something else yet need to be done?
you have to pass the path to the php config binary - should be something like
/opt/lampp/bin/php-config
All the binaries in XAMPP are located in
/opt/lampp/bin
That's why if you work with XAMPP's PHP version you ought to proceed all operations using binaries from there.
For example, after installation of XAMPP it's possible to set path to it's PHP bin file.