简体   繁体   中英

PHP-CLI not found

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", eg "/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:

PHP Cli错误

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

PHP信息

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.

PHP CLI 2

Edit

Result of /bin/php -v below.

PHP CLI -v结果

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM