Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP-CLI not found

Tags:

php

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:

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

PHP Info

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 Result

like image 791
Dennis Strooband Avatar asked Aug 07 '13 20:08

Dennis Strooband


People also ask

How do you check php CLI is installed or not?

Try running php --version on the commandline. If it works, it's installed.

What is the php CLI?

PHP's Command Line Interface (CLI) allows you to execute PHP scripts when logged in to your server through SSH. ServerPilot installs multiple versions of PHP on your server so there are multiple PHP executables available to run.


2 Answers

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.

like image 130
Álvaro González Avatar answered Nov 15 '22 16:11

Álvaro González


try the following to find it:

sudo find / -name php-cli

You most likely want php instead of php-cli though.

like image 20
kwolfe Avatar answered Nov 15 '22 16:11

kwolfe