• PHP OK but “Error establishing a database connection!” on Mac
    I have been trying to install WordPress according to the instructions on the MacZealots page, but with success only to the point of starting WordPress(PowerBook 1GHz, OS X 10.3.6). My intention is to use my own computer as a server.
    The MySQL installation went OK. I can get into MySQL with my password (MySQLPassword) and I understand that I am username ‘root’.
    When I open the page https://localhost/index.php I get loads of information about PHP 4.3.2.
    My wp-config.php file inside my ‘wordpress’ folder (which is in the ‘Documents’ folder of /Library/WebServer includes
    // ** MySQL settings ** //
    define(‘DB_NAME’, ‘wordpress’); // The name of the database
    define(‘DB_USER’, ‘root’); // Your MySQL username
    define(‘DB_PASSWORD’, ‘MySQLPassword’); // …and password
    define(‘DB_HOST’, ‘localhost’); // 99% chance you won’t need to change this value
    …but when I enter
    https://localhost/wordpress/wp-admin/install.php
    or
    https://127.0.0.1/wordpress/wp-admin/install.php
    I get the:
    ‘Error establishing a database connection! This probably means that the connection information in your wp-config.php file is incorrect. Double check it and try again…’
    message…
    If I open file:///Library/WebServer/Documents/wordpress/wp-admin/install.php (which was linked in one of the help pages) I see pages of text with Step 1,2,and 3, with the last telling me that:
    ‘What is the web address of your WordPress installation? (We probably guessed it for you correctly.)’
    followed by a box with: ‘<?php echo $guessurl; ?>’
    My understanding is that my username or password for MySQL somehow don’t suit my wp-config.php file, but I don’t know why.
    I’d be grateful for any feedback. Probably the answer is under my nose, but I have trekked around the Web to find it – until now with not much luck.
    For your information, I’ll add a couple of provisos:
    When I first tried this out, I had modified my httpd.conf file to listen in on port 8008 as my provider had blocked port 80. There was no problem accessing my computer from the web outside. I included:
    Listen 8008 and Port 8008
    in the relevant places with the same results I have just described. Now I have commented these entries out to give me normal port 80 behaviour, but with no success locally. Strangely, the line:
    LoadModule log_forensic_module libexec/httpd/mod_log_forensic.so
    is missing from my httpd.conf file, though present in my httpd.conf.default file. I don’t know how this was caused or whether it is important. Everything else looks normal.
    In short, I’m pretty confident that I have followed the MacZealot instructions, but from what I have read, there seems to be a problem with my wp-config.php file that I can’t pick. Am I not username ‘root’ in the context of WordPress?
    Any thoughts or insight would be most appreciated.

Viewing 13 replies - 1 through 13 (of 13 total)
  • I have it running on my iBook right now, actually a few instances of it. I’m assuming you’ve set up mysql correctly and you’ve gone in by some means (I use phpmyadmin) to create the “wordpress table”. Do you know what your permissions are on those tables? You might want to contact me off list and I can help get you on your feet.
    ryan at duff-duff dot net
    I have a few instances of it running, in the root of the webserver like you, not the my ‘sites’ folder. MySQL was the biggest pain in the @ss to get set up though.

    Thread Starter petrushka

    (@petrushka)

    Thanks for the feedback.
    I actually used the MacZealots instructions to set the whole thing up and as MySQL did everything that it was supposed to (according to MacZealot), I assumed everything was OK. As far as creating the basic tables, I thought that was done automatically when accessing install.php.
    I read somewhere that one has to deliberately link the owner with the DB, but more than this, I don’t know.
    I’ll read around some more and then maybe take up ryanduff’s kind invitation.
    Cheers.

    Moderator James Huff

    (@macmanx)

    Are you sure that your wp-config.php file is 100% correct? I’d question that before I’d question the actual database.

    I too recently installed wp on a macintosh g5 running osx 10.3.6 that is being used as a webserver but have no dns (i just use ip number:8080 to get to my website), I also am having similar problems as Petrushka. I get the following errors when trying to load the index.php page in my browser:
    Warning: Unknown(/Library/WebServer/Documents/blog/index.php): failed to open stream: Permission denied in Unknown on line 0
    Warning: (null)(): Failed opening ‘/Library/WebServer/Documents/blog/index.php’ for inclusion (include_path=’.:/usr/lib/php’) in Unknown on line 0
    After doing numerous yahoo and google searches i ran across a post that said php doesn’t do well without dns name service and once you get that it will work fine (see https://www.dayanahost.com/forum2/index.php?act=Print&client=printer&f=3&t=344&#38;). Anybody know if this true?

    Moderator James Huff

    (@macmanx)

    Thanks, but I too, already followed that tutorial and after all was said and done, the above error msgs are the result. WP is trying to work as I can login and get to the admin page but whenever I try to view the blog all I get is a page with the above error messages.

    Moderator James Huff

    (@macmanx)

    Try setting the files’ permissions to 755 (CHMOD 755).

    I’m willing to try to change some file permissions: but exactly which files? All the files in the wordpress directory or just certain files?
    You are going to have to lead me by the nose: if I’m in the terminal on my mac what commands do i type?

    Moderator James Huff

    (@macmanx)

    All of the files in the WordPress directory, including those in wp-admin, and etc. The easiest way to do it would be through and FTP app like RBrowserLite, browse through your hard drive to the WP files, select each file and hit the info button. Now, RBL uses a graphical CHMOD interface, rather than CHMOD number, but this is what 755 should look like (check mark = ‘/’):
    / / /
    / x x
    / / /
    https://www.rbrowser.com/RBrowserLite/RBrowserLite.html

    Thanks macmanx, i went in through the terminal and listed all file permissions for the files in the wordpress directory and saw two files not set at 755 permission: index.php and wp-layout.css I chmod 755 them and finally got the blog to load in the web-browser!
    You set me on the right path to a fix, thanks for all your help.

    Moderator James Huff

    (@macmanx)

    No prob, glad I could be of some assistance.

    Thread Starter petrushka

    (@petrushka)

    I found a solution for “Error establishing a database connection!”, although it was not related to a problem with permissions or my wp-config.php file, as macmanx suggested.
    I had been using MySQL 4.1.7 (as I wanted to be up-to-date), and decided to erase it and use the CompleteMySQL 4.0.21 installer which I had seen mentioned in the MacZealots WordPress installation comments. On doing so. I immediately had access to phpMyAdmin at localhost (using ‘root’ and my MySQL password), and after adding a new database ‘wordpress’, I could access https://localhost/wordpress/index.php with no problems.
    After reading more closely the upgrade instructions for MySQL 4.1.7, I see that there seems to be a way around the password bug/problem, but as I have it up and running, I might leave that until later.
    Thanks for all of your input and taking the time to respond.

    Thread Starter petrushka

    (@petrushka)

    I forgot to add that I did go through h**p://localhost/wordpress/wp-admin/install.php after my reinstallation to automatically set up my tables, and then to wordpress/index.php.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘PHP OK, but “Error establishing a data..” on Mac’ is closed to new replies.