0

I have googled this to the edge of my ability and the current results don't seem to apply to me.

A couple days ago, the admin made some changes to the system, and the script I had to run nightly stopped working. When I would attempt to run the script I would get the following:

PHP Warning:  mysql_connect(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in /Path/UpdateDB.php on line 2
PHP Warning:  mysql_connect(): No such file or directory in /Path/UpdateDB.php on line 2
PHP Warning:  mysql_select_db(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in /Path/UpdateDB.php on line 3
PHP Warning:  mysql_select_db(): No such file or directory in /Path/UpdateDB.php on line 3
PHP Warning:  mysql_select_db(): A link to the server could not be established in /Path/UpdateDB.php on line 3
No connection.

I contacted the admin and she said that she made some changes. When I ran that script this morning I just got the failure messages that I set up that are giving me this error:

MySQL error Data truncated for column 'GameID' at row 1

Now I checked all the other that were talking about the tables being strict and having my data be too large, but GameID is an int and the largest value that I have is 1737690.

At one point I set the failure to echo my statement, and then manually tried to run that in phpmyadmin and it worked. So that makes me believe it's something with the path it's trying to use.

EDIT: This is the email from the admin:

Some updates were done last break. OSX has php installed at /usr/bin/php. We installed a local php at /usr/local/bin/php and configured it to work with mysql. You you need to ensure you use php at /usr/local/bin/php.

I have restored your crontab file. I also added a MAILTO and PATH. All are commented out for now. If you uncomment the UpdateDB.php you should also uncomment the MAILTO and PATH. MAILTO will send any output to your email address. PATH will ensure that /usr/local/bin/php is used instead of /usr/bin/php.

#MAILTO=evan.lepolt@gmail.com
#PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/usr/local/mysql/bin

#0 * * * * cd ~/Path; php UpdateDB.php;

I have updated the PATH you get when you SSH to ucfilespace.uc.edu. So it now has /usr/local/bin first so /usr/local/bin/php will be used instead of /usr/bin/php if you use php command.

/usr/local/bin/php has the mysql socket defined as /tmp/mysql.sock. So you script should now work via cron and at command line also.

Community
  • 1
  • 1
ELepolt
  • 373
  • 2
  • 4
  • 16
  • I asume you asked the admin _what_ she actually did change. Do you mind sharing this knowledge with us? – arkascha Oct 08 '13 at 13:40
  • That sounds so filmy..Coming to your point..Check these link..http://stackoverflow.com/questions/14764080/error-1265-data-truncated-for-column-when-trying-to-load-data-from-txt-file – Joke_Sense10 Oct 08 '13 at 13:44
  • Just posted the email in the edit. – ELepolt Oct 08 '13 at 14:10
  • @arkascha Based on my edit, I have to believe it has something to do with the path my script is trying to use. Is there a way to force it to use a separate path? – ELepolt Oct 08 '13 at 15:31
  • Find out which php version you are using (use `phpinfo()` for this), there is little sense in _guessing_ such things. When you ask if it is possible to force _it_ to use some path I have to ask back: well, what is _it_? It might be the cron job mentioned, then the easiest would be simply to change that crontab entry and use the absolut path (`/usr/local/bin/php`) instead of leaving that to the shell environment. – arkascha Oct 08 '13 at 17:39

0 Answers0