Search code examples
phpbinarycentosvirtualmin

Detecting PHP binary path - strange situation


I have no PHP_BINARY nor PHP_BINDIR in my phpinfo output. There's 3 versions on the server - 5.3 5.6 7.0 and Virtualmin. Default is 5.6 - it servers http requests fine. But I also need to run cronjobs by this version, but

# /usr/bin/php -v
PHP 5.3.3 (cli) (built: Mar 22 2017 12:27:09)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Another attempt:

whereis php
php: /usr/bin/php /etc/php.ini /etc/php.d /usr/lib64/php /usr/share/php 
/usr/share/man/man1/php.1.gz

Here is my phpinfo's text. https://pastebin.com/T0WSwJ1c

Please help!

Added - I changed php mode from fastcgi to Apache handler, and again - no PHP_BINARY nor PHP_BINDIR in 5.6 phpinfo output. I searched for all php-like files

find / -name 'php*' > php.txt

result is here https://justpaste.it/1bwap

and I found cgi binary(?) /home/***/cgi-bin/php5.6.cgi (username sensored) ok it return 5.6 version but how to run cron with this?!

# /home/****/cgi-bin/php5.6.cgi ./t.php
PHP Warning:  Unknown: Filename cannot be empty in Unknown on line 0
Status: 404 Not Found
X-Powered-By: PHP/5.6.25
Content-type: text/html; charset=UTF-8

No input file specified.

Solution

  • Finnaly I found it at /opt/rh/rh-php56/root/usr/bin/php

    When I posted find / -name 'php*' > php.txt I removed a bunch of /opt/rh/something.. results thinking of them as quite irrelevant.