0

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());
Asad kamran
  • 440
  • 10
  • 21
  • What does your stack look like? Assuming this is not running locally correct? – Mark Hayden Aug 24 '14 at 06:26
  • are your sure the database credentials are set properly when cron calls your page? –  Aug 24 '14 at 06:26
  • http://stackoverflow.com/questions/5376427/cant-connect-to-local-mysql-server-through-socket-var-mysql-mysql-sock-38 – Asif Aug 24 '14 at 06:28
  • @Mark, I can not see Stack, I don't have server access, but server guy execute the script on command line and it works. But not working As a CronJob. – Asad kamran Aug 25 '14 at 12:38
  • @vlzvl, Database credential are ok. MySQL user have full rights, and Same username and password are already working on site. – Asad kamran Aug 25 '14 at 12:38

0 Answers0