ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have Fedora Core 3 with Apache, PHP and MySQL installed by default. I am tring to connect PHP with MySQL. But phpMyAdmin gives the error "#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)".
When I tried to connect using my own PHP codes, I got the error
Quote:
Unable to connect to MySQL : Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
The code I used is
Quote:
//Connect to the database
mysql_connect("localhost","root",'') or die("Unable to connect to MySQL : " . mysql_error());
//Select the necessary Database
mysql_select_db('test') or die("Unable to select the database 'test' : " . mysql_error());
There is no problem with mysql. I can run the program using the 'mysql -u root -p <password>' command. In this shell I can access the databases and tables without any problem. But I cannot access the MySQL server from PHP.
-- check php.ini /usr/local/lib/php.ini , after that check the compiling command. Make sure that compile command have option --with-mysql=$path.
-- if still still error check in local db store, check ownship (it must mysql). after that "./mysqld_safe --user=mysql &" (configuration in /etc/my.cnf)
I get this error every time I reinstall my linux distro... and now I can't recall the solution. There are permissions and selinux issues if I recall, but I think for me I simply didn't have all the required packages. Make sure you have mysql, mysql-server, and php-mysql. I think my problem was that I had mysql and php-mysql but not mysql-server.
Open /etc/selinux/config
Change the line
SELINUX=enforcing
TO
SELINUX=disabled
Then restart the system.
One doubt - how will this affect me? I know that selinux has something to with security - but not more than that. What is the the function of selinux? Will I run into any trouble by disabling it?
Security is not much of an issue for me - the system I am working on is connected to just another computer inside my home - no other network has access to it. Also the system will NOT be a internet web server. I need PHP/MySQL to test my programs at home - not for serving files over the net. So will there be a problem if I disable selinux?
One doubt - how will this affect me? I know that selinux has something to with security - but not more than that. What is the the function of selinux? Will I run into any trouble by disabling it?
no, you won't run into trouble by not using it... it's just an aditional security option you can add to your linux systems to make them harder to crack...
Quote:
Security is not much of an issue for me - the system I am working on is connected to just another computer inside my home - no other network has access to it. Also the system will NOT be a internet web server. I need PHP/MySQL to test my programs at home - not for serving files over the net.
yeah, IMHO it sounds like you don't really have much use for selinux...
of course, when you finally do set the box up as an internet server then selinux is something you should at least consider learning to use, as it's a valuable tool when it comes to mission-critical linux installations...
I have Fedora Core 3 with Apache, PHP and MySQL installed by default. I am tring to connect PHP with MySQL. But phpMyAdmin gives the error "#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)".
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.