PHP cronjob failed due to mysql error

412 Views Asked by At

i set a cronjob from cpanel but unexpectedly it cause mysql error.

This is the command i set from CPANEL:

php -f /home/server1/public_html/xad/imp.php

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());
0

There are 0 best solutions below