mhoofman / wordpress-heroku

Template project for deploying WordPress to Heroku
Other
1.3k stars 704 forks source link

"Can’t select database" error when attempting local install on OSX Yosemite #92

Open meowist opened 9 years ago

meowist commented 9 years ago

My remote config works fine on Heroku, but I can't get Wordpress to recognize my local postgres db. I followed the instructions here step by step, but still no dice: https://github.com/mhoofman/wordpress-heroku/wiki/Setting-Up-a-Local-Environment-on-Mac-OS-X

Below are screenshots to clarify what I've done on my end. I have not touched the wp-config files, which seems like a problem, but since it's not mentioned in the OSX local install instructions I left it as-is.

Any help much appreciated!

Unable to select database error: http://i.gyazo.com/12169c260615bdff26c45d9c0ec7058f.png

Database 'wordpress' does exist, user 'wordpress' exists with all privileges: http://i.gyazo.com/74db34e00da6758044434dc77fe3b6ed.png

envars file includes export for 'wordpress' database http://i.gyazo.com/7599bb363b7156dde1260cda904d13a1.png

MAMP apache server is running http://i.gyazo.com/773099b7bcaa87182d866e48163c38d5.png

MAMP points to my doc root (I changed this from the default /htdocs location): http://i.gyazo.com/94920ee0b106a12a180c432351dcb8b9.png

jiang925 commented 9 years ago

Check this blog out. It fixes the "Can't select database problem on WordPress on Heroku".

http://blog.jiang925.com/2015/06/01/run-heroku-version-of-wordpress-locally-on-raspberry-pi-fixed-cant-select-database-problem/

igorauad commented 8 years ago

@meowist how did you solve this? I am having the same problem and the above link posted by @jiang925 appears to be unavailable. Thanks

jiang925 commented 8 years ago

@ibroadfo Rebooted the server. I don't remember exactly what I did. In essence:

change this line in wp-config.php

$db = parse_url($_ENV["DATABASE_URL"]);

to

$db = parse_url(getenv("DATABASE_URL"));

igorauad commented 8 years ago

Thanks, @jiang925 . I believe it worked, but now I am stuck again at:

One or more database tables are unavailable. The database may need to be repaired.
igorauad commented 8 years ago

Ok, I found the silly mistake. I had not payed attention to the PHP version. I was using PHP 7.0.10 on MAMP. Only when I actually looked into the logs, I noticed that it is not compatible. Switching to PHP 5.6.25 on MAMP solved the problem.