Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
由于mysql错误,PHP cronjob失败_Php_Mysql_Cron_Cpanel_Mysql Pconnect - Fatal编程技术网

由于mysql错误,PHP cronjob失败

由于mysql错误,PHP cronjob失败,php,mysql,cron,cpanel,mysql-pconnect,Php,Mysql,Cron,Cpanel,Mysql Pconnect,我从cpanel设置了一个cronjob,但意外地导致了mysql错误 This is the command i set from CPANEL: php-f/home/server1/public_html/xad/imp.php 你的堆栈看起来像什么?假设这在本地运行不正确?当cron调用您的页面时,您确定数据库凭据设置正确吗?@Mark,我看不到堆栈,我没有服务器访问权限,但服务器人员在命令行上执行脚本,它就可以工作了。但不能作为CronJob工作。@vlzvl,数据库凭据正常。MyS

我从cpanel设置了一个cronjob,但意外地导致了mysql错误

This is the command i set from CPANEL:
php-f/home/server1/public_html/xad/imp.php


你的堆栈看起来像什么?假设这在本地运行不正确?当cron调用您的页面时,您确定数据库凭据设置正确吗?@Mark,我看不到堆栈,我没有服务器访问权限,但服务器人员在命令行上执行脚本,它就可以工作了。但不能作为CronJob工作。@vlzvl,数据库凭据正常。MySQL用户拥有完全的权限,相同的用户名和密码已经在站点上运行。
It need to be executed after half hour.

1) This job runs from browser without issue. 

2) Also it runs from commandline correclty.
**root@server1 [~]# php -f /home/server1/public_html/xad/imp.php**


But it failed from cpanel cronjob setting and cause mySQL Error:

**Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)**

I am using pconnect as below:
$link = mysql_pconnect($hostName, $userNam_souq, $password) or die(mysql_error());