dongmo2324 2016-02-27 11:15
浏览 41

我服务器上的哪个地方是提供网页的PHP版本?

I'm on a shared server. When I save a script with phpinfo() and open it in the browser, the script tells me "PHP Version 5.6.18":

enter image description here

When I visit my server through SSH and look in /usr/local/bin, ls shows me PHP versions from 4 to 5.5, but no version 5.6:

enter image description here

When I search for PHP with which php, I get the following (with results from ... -v in parentheses):

/usr/bin/php (4.4.9)
/usr/bin/php4.4
/usr/bin/php5.2
/usr/bin/php5.4
/usr/bin/php5.5
/usr/bin/php5.4-cli
/usr/bin/php5.5-cli
/usr/bin/php4.4-cli
/usr/bin/php5.2-cli
/usr/lib/php (directory, contains extensions)
/usr/lib/php4.4
/usr/lib/php5.4
/usr/lib/php5.5
/usr/lib/php5.2
/usr/local/bin/php (4.4.9)
/usr/local/bin/php5.4
/usr/local/bin/php5.5
/usr/local/bin/php4.4
/usr/local/bin/php5.2
/usr/local/lib/php.ini-nourl
/usr/include/php4.4
/usr/include/php5.4
/usr/include/php5.5
/usr/include/php5.2
/usr/local/php (4.4.9)
/usr/share/php (directory, contains: libzend-framework-php  wp-cli)

So where is PHP 5.6?

I want to run a script through a cronjob using the same PHP or a similar version as the one serving web pages, e.g.

0 * * * *  /usr/local/bin/php5.6 -f/path/to/script.php

but I don't know where PHP 5.6 lives.

How can I find PHP 5.6 on my server?

I'm on a shared Linux server running Apache. I called my hosting provider but the weekend staff has no idea and asked me to call on Monday. Can you help me before then?

展开全部

  • 写回答

2条回答 默认 最新

  • duanhui1185 2016-02-27 12:03
    关注

    use /usr/local/bin/php, since the higher version of php in your server is 5.6 the default php file is the 5.6 version

    评论
  • dthdlv9777 2016-02-27 12:22
    关注

    PHP constant PHP_BINARY keeps info of current PHP interpreter:

    <?php var_dump(PHP_BINARY); ?>
    

    It'll return soomething like this: string(13) "/usr/bin/php5". Then:

    $ /usr/bin/php5 -v
    

    In your specific case probably php5 is the PHP v5.6.

    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部