Can't connect to socket [Solved]

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Can't connect to socket [Solved]

Postby akhasis » 14. March 2012 10:59

Hello!

I know this topic has ben discussed many times before, but I've followed the advice in previous related posts with no success.

I'm trying to run a php script via cron, i.e., in a terminal. When I run it, I get the following error:

Can't connect to local MYSQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /opt/lampp/htdocs/applicationfolder/script.php on line X


Since I'm not authorized to make big changes in the system, I have only tried to solve the issue by editing some values in the my.cnf, as suggested in some posts in this same forum and other related ones:

We just have to modify the socket parameter on our my.cnf with the right path to the XAMPP socket:

bdispatcher@tatil02:/opt/lampp$ sudo find /opt/lampp/ -iname "*.sock*"
/opt/lampp/var/mysql/mysql.sock


It happens that I have 3 my.cnf files in my system, and since I am not very experienced in Ubuntu, I don't know which one to change, so I changed all of them:

    /etc/my.cnf
    /etc/mysql/my.cnf
    /opt/lamp/etc/my.cnf

I also don't know if they all are necessary and I may even have created some of them following some blog instructions to solve my problem. But as I said my ubuntu level is so low that I can't remember which one or why.

Ubuntu 9.04, xampp 7.1.1

Thank you in advance for any help you can provide me!
akhasis
 
Posts: 2
Joined: 14. March 2012 10:38
Operating System: Ubuntu 9.04

Re: Can't connect to socket [Solved]

Postby akhasis » 14. March 2012 14:08

Ok, found the error. It was all my mistake.

As I read on other posts, there are two simultaneous instalations of php on my Ubuntu. The thing is, I was trying to launch my script with the wrong PHP (the one that was installed before xampp) like this:

/usr/bin/php /opt/lampp/htdocs/applicationfolder/script.php

When it should be launched with the xampp PHP, like this:

/opt/lampp/bin/php /opt/lampp/htdocs/applicationfolder/script.php

Hope this helps someone, since I've spent 3 days looking for an answer with no luck :D
akhasis
 
Posts: 2
Joined: 14. March 2012 10:38
Operating System: Ubuntu 9.04


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 16 guests