Reputation:
I'm running a PHP script as a cronjob. I need PHP 5.4 or greater. Which path should I use? I have:
(uiserver):z2309ii3ee:~ > whereis php
php: /usr/bin/php /usr/bin/php5.4 /usr/bin/php5.5 /usr/bin/php5.4-cli /usr/bin/php5.5-cli /usr/lib/php /usr/lib/php.ini /usr/lib/php5.4 /usr/lib/php5.5 /usr/lib/php.ini-nourl /usr/local/bin/php /usr/local/bin/php5.4 /usr/local/bin/php5.5 /usr/local/lib/php.ini-nourl /usr/include/php /usr/include/php5.4 /usr/include/php5.5 /usr/local/php /usr/share/php
The online help of my hoster says I should use /usr/local/bin/php5
, but that's PHP 5.2.17.
Why should I not use /usr/lib/cgi-bin/php5.4
with a cronjob? That is the version run when I call a script in my browser (says echo PHP_BINARY;
).
Upvotes: 1
Views: 1122
Reputation: 72226
/usr/lib
usually contains libraries and other files that are needed by a program but not the program itself (the executable file(s)). The programs stay in /bin
, /usr/bin
, /usr/local/bin
or subdirectories of these.
I would try to ls -l
or file
with /usr/bin/php5.5
, /usr/bin/php5.5-cli
or /usr/local/bin/php5.5
to find out if they are executable files or directories. If they are directories, it's possible they have the executable files inside their own bin
subdirectories (i.e. /usr/bin/php5.5/bin/php
and similar).
After I find the executable file(s) I need I would run it (them) with option --version
to see if it is the version I need.
Upvotes: 0
Reputation: 43479
If it's working, use newest version (or that is compatible with your code).
Upvotes: 1