php问题,当在linux上使用点斜杠文件名格式运行时


php issue when running on linux with dot slash filename format

我在linux 中有一个php脚本(file1.php)

#!/usr/bin/php -q
<?php
 echo "hello world" ?> 

当我在linux(redhat@bash-shell)中运行时

>  php file1.php

它是有效的。我的php在/usr/bin.php中,它的版本是5.3.3)

但是当我运行时

./file1.php

上面写着

'./file1.php' not present.

我的应用程序需要这个('./file1.php')模型来工作

在我的另一台机器上,这个文件适用于('./file1.php')型号的

为什么会这样,有什么办法解决这个问题吗。。

  • **/usr/bin/php-v运行良好
  • 文件权限(file1.php):-rwxr-xr-x 1 root**

您应该指出文件应该如何执行。在bash中,使用shebang尝试添加这一行添加php脚本的最顶部:

#!/usr/bin/php
<?php echo 'Hello world!';

这将告诉bash将./file.php作为php /fullpath/file.php运行更多信息http://en.wikipedia.org/wiki/Shebang_(Unix)