php.ini modification does not take effect

Posted on 2008-02-07
Medium Priority
Last Modified: 2013-12-13

I'm having a problem with accessing to MySQL via PHP.
The problem is that PHP ties to find MySQL socket in /tmp/mysql.sock.

PHP returns "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) ".

But actual socket is in /var/lib/mysql/mysql.sock.
This is configured on my.cnf (socket          = /var/lib/mysql/mysql.sock -> mysqld & client) and php.ini as well (mysql.default_socket = /var/lib/mysql/mysql.sock).

But phpinfo() returns:

Configuration File (php.ini) Path       /usr/local/lib
MYSQL_SOCKET       /tmp/mysql.sock

My php.ini located in  /etc/php.ini

How do I solve this problem?
Please someone advise.

Thank you.
Question by:eb110k

Accepted Solution

emphamy earned 1000 total points
ID: 20847992
sounds like you are editing the wrong ini/cnf file, make sure you are editing the one that mysql actually uses to run or php, sometimes servers have multiple ones, what is your server setup? and what time of linux os do you have?
LVL 10

Assisted Solution

Nellios earned 1000 total points
ID: 20849081
If we assume that you are editing the correct file ... have you restarted apache?

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question