CebtOS下添加计划任务出错
呼叫军哥,不懂添加计划任务。总是出错建立了sh文件,内容如下:
#!/bin/sh
php http://xxx.xxx.com/xxx.php?xxx
执行该sh调试时报错如下:
./xxx.sh: line 2: 0: command not found
========背景======
其实一开始时是直接crontab -e来添加计划任务,但是发现一直没有执行,/var/spool/cron下对应用户的cron文件是已经设置了可执行权限 的。在SSH上直接./root也发现同样错误:line *: 0: command not found 你哪个php脚本有问题
回复 2# 的帖子
php脚本有问题?但是我直接在浏览器上打开URL,又是正常的 浏览器可以打开,脚本里直接用curl 访问你那个地址试试 用curl执行这个URL也是同样错误。执行php /home/site/XXX/*.php是成功的,但是尝试将这个URL直接php /home/site/XXX/*.php?xxxx时,又显示出来的是错误,无法执行 /usr/bin/curl http://xxx.xxx.com/*.php?xxxx
这个是无法执行的,或者curl http://xxx.xxx.com/*.php?xxxx也同样无法执行,错误都是comman not found comman not found就是curl没装,装上就行了 yum install php-common
yum install php-curl
# yum install php-curl
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: centos.ustc.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php53-common.i386 0:5.3.3-13.el5_8 set to be updated
--> Processing Conflict: php53-common conflicts php-common
--> Finished Dependency Resolution
php53-common-5.3.3-13.el5_8.i386 from base has depsolving problems
--> php53-common conflicts with php-common
Error: php53-common conflicts with php-common
You could try using --skip-broken to work around the problem
You could try running: package-cleanup --problems
package-cleanup --dupes
rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.
之後
/usr/bin/curl http://xxx.xxxx.org/xxx.php?xxxx
21228
21229
21230
21231
21232
21233
21234
21235
# -bash: 0: command not found 不知为何,使用wget命令遇到同样的错误:
# /usr/bin/wget -q http://xxx.xxxx.org/xxx.php?xxxx
23070
23071
23072
23073
23074
23075
-bash: 0: command not found
23076
23077
Done siteid=22
Exit 127 0
Done collectname=0
Done startpageid=1
Done maxpagenum=10 会不会是root没有PHP的执行权限?或者其他权限问题? curl是curl
php-curl是php-curl不是一样的东西,如果让你装php-curl我就和你说装php curl扩展了 怎么安装?yum install curl ?
回复 11# 的帖子
# yum install curlLoaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: centos.ustc.edu.cn
Setting up Install Process
Package curl-7.15.5-16.el5_9.i386 already installed and latest version
Nothing to do 发现在/usr/bin下,php链接到/usr/local/php/bin/php,所以可以执行php页面,但是仍然无法执行类似"php?xxx"则php后面还有尾巴的页面。
同时在/usr/bin下,curl并没有链接到具体的程序,所以总是显示command not found。
回复 14# 的帖子
呼叫军哥,求救解决方法
页:
[1]
2