Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I force PHP Version for Command Line?

I am hosted with 1and1.com, and I have setup my files to be parsed with php5 using .htaccess.

But that only works in apache, and not in command line, which defaults to the server default php4.

So currently I can not setup cron jobs to run my code as php5. Any ideas?

like image 914
Bluemagica Avatar asked Oct 14 '11 12:10

Bluemagica


1 Answers

In accordance to https://community.1and1.com/using-php-composer-at-1and1/, create .profile in your root projet and add the line :

alias php='/usr/bin/php5.5-cli'

It works for me. Log out and log back in SSH and do :

php -v

Result :

PHP 5.5.32 (cli) (built: Feb 15 2016 16:13:44)

like image 93
dicotout Avatar answered Oct 25 '22 17:10

dicotout