Forum

Thread tagged as: Problem, Configuration, Hosting

Perch could not connect to the database, local machine

Running PerchTest locally and get this message?

Error message
SQLSTATE[HY000] [2002] No such file or directory
Jon H

Jon H 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Did you get a pass from the Perch Compatibility Test? If not that would be the first thing to try.

Jon H

Jon H 0 points

Hi Rachel,

I tried that and it failed. I have the following file structure for local development:

/Users/<username>/Sites/Site1
/Users/<username>/Sites/Site2
/Users/<username>/Sites/Site3

These are connecting to the perch database perfectly however all the links, css, js links aren't working as they're all relative etc. So I created a virtual host for each of the sites:

site1.local
site2.local
site3.local

When I load in browser all the links and references to css, js files work but perch can't connect to the database?

Running the perchtest with url localhost/site1/perchtest does work but running with the same credentials using url site1.local/perchtest doesn't? And the message below is displayed:

SQLSTATE[HY000] [2002] No such file or directory

Same files, same location, same db credentials?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

I can't really advise on your local environment I'm afraid. If you are using something like MAMP etc. then you should ask them for help getting set up. Once you get the test to pass then Perch will install.

Jon H

Jon H 0 points

I've got Perch installed but when creating new pages links are pointing to the localhost root directory and not the virtual server. For example:

https://localhost/about.php

instead of

https://site1.local/technical-advice

I'm basically trying to achieve the same setup you use in your demos.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Please post your Diagnostics Report.

Jon H

Jon H 0 points

Perch: 2.8.24, PHP: 7.0.0, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: 7e72f9690b1498a1bead7a637c33a831c0d2f655 $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.24), assets (2.8.24), categories (2.8.24)
App runtimes: <?php $apps_list = array( 'content', 'categories', );
PERCH_LOGINPATH: https://localhost/site1/cms
PERCH_PATH: /Users/Jon/Sites/site1/cms
PERCH_CORE: /Users/Jon/Sites/site1/cms/core
PERCH_RESFILEPATH: /Users/Jon/Sites/site1/cms/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: dc1fef2ad0fcd9f943c02ebb43d85dbc
Resource folder writeable: Yes
HTTP_HOST: localhost
DOCUMENT_ROOT: /Users/Jon/Sites
REQUEST_URI: /site1/cms/core/settings/diagnostics/
SCRIPT_NAME: /site1/cms/core/settings/diagnostics/index.php
Rachel Andrew

Rachel Andrew 394 points
Perch Support

You appear to be logged in at localhost:

https://localhost/site1/cms

I'd suggest creating vhosts but you will need to check with the Mamp documentation for how to do that.