How can I force PHP Version for Command Line?

前端 未结 7 1753
说谎
说谎 2020-12-17 17:01

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, wh

7条回答
  •  死守一世寂寞
    2020-12-17 17:36

    At least on Linux you can also specify the wanted PHP version in the first line of your script like so:

    #!/usr/bin/php5.6
    
    

    Make your script executable and specify the cron job in the following way:

    # Just runs the script, which itself cares for the right php version
    * * * * * root "/path/to/script.php"
    

提交回复
热议问题