"No such file or directory"

I'm trying to install Omeka locally, on my Mac, and after I create a virtualhost, move the code in there, add a mysql database, set up db.ini and load up the site in the browser, I get this error:

Omeka Has Encountered an Error
No such file or directory

If I go directly to /install, I get this error:


Fatal error: Uncaught exception 'Zend_Db_Adapter_Mysqli_Exception' with message 'No such file or directory' in /Users/sandor/Sites/omeka/application/libraries/Zend/Db/Adapter/Mysqli.php:333 Stack trace: #0 /Users/sandor/Sites/omeka/application/libraries/Zend/Db/Adapter/Abstract.php(448): Zend_Db_Adapter_Mysqli->_connect() #1 /Users/sandor/Sites/omeka/application/libraries/Zend/Db/Adapter/Abstract.php(706): Zend_Db_Adapter_Abstract->query('SHOW TABLES LIK...', Array) #2 [internal function]: Zend_Db_Adapter_Abstract->fetchAll('SHOW TABLES LIK...') #3 /Users/sandor/Sites/omeka/application/libraries/Omeka/Db.php(74): call_user_func_array(Array, Array) #4 [internal function]: Omeka_Db->__call('fetchAll', Array) #5 /Users/sandor/Sites/omeka/install/models/Installer.php(318): Omeka_Db->fetchAll('SHOW TABLES LIK...') #6 /Users/sandor/Sites/omeka/install/controllers/IndexController.php(40): Installer::isInstalled(Object(Omeka_Db)) #7 /Users/sandor/Sites/omeka/application/libraries/Zend/Controller/Action.php(502): IndexController-> in /Users/sandor/Sites/omeka/application/libraries/Zend/Db/Adapter/Mysqli.php on line 333

I found this thread about the same topic, from a year go, but it's with a much older version of the software, so I don't know how relevant it is. I did notice at the end that dwoods solved his problem by rebuilding the server as 32-bit. I'm on a new MacBook Pro, and I'm guessing things are installed as 64-bit. Will I need to rebuild PHP as 32-bit in order to get Omeka working?

Thanks.

The "no such file or directory" error is normally a symptom of a mismatch between where PHP is trying to look for a file it needs to connect to your server, and where that file is actually located.

If you run the command 'mysql --print-defaults', one of the first things printed should say "--socket={path to socket}". That path needs to be put in your php.ini file (which is /etc/php.ini on a default Mac install).

You want to find the line that starts with mysqli.default_socket and change it to read

mysqli.default_socket = {path to socket}

Where {path to socket} is the same file path that you got from running "mysqld --print-defaults" above.

Hi John. Thanks for the reply.

When I run that command, I get this:

mysql would have been started with the following arguments:

And nothing below. No mention of the socket. However, I have MySQL running fine on my computer -- I use it frequently for other virtualhosts. This is how my php.ini reads:

mysqli.default_socket = /var/mysql/mysql.sock

So i'm not sure where to go from here. Any ideas?

Thanks,
-S

I still believe that the socket issue is most likely your problem. The specific error that you're seeing is caused when PHP is unable to connect to your MySQL server.

To be more sure where the problem lies, though, there's one more set of commands you can run to get more information.

With your MySQL server running, run the following command:

file /var/mysql/mysql.sock

As well as:

file /tmp/mysql.sock

One of those two commands should simply output the file name and the word "socket"; this is the correct path for mysqli.default_socket. The other will print a "No such file or directory" error.

Hooray! That did it. "file /var/mysql/mysql.sock" returned the error, so I switched it to the other and it worked.

What's curious is how all my other PHP/MySQL sites were working if the socket setting was incorrect. Oh well, I just checked and they still do, so all's well that ends well.

Thanks, John. Appreciate it.