• Resolved johnhardy

    (@johnhardy)


    Hello,
    I am having some trouble in creating a basic WordPress site on my localhost.
    The wp-config.php file was not created so I created one from my wp-config-sample.php file
    This produces an error

    Parse error: syntax error, unexpected identifier “DB_HOST”, expecting “)” in C:\xampp\htdocs\wptest\wp-config.php on line 32.
    When I look at the file with notepad ++ I can see an error on line 29

    /** Database password */
    define( ‘DB_PASSWORD’, ‘—- ); no closing ‘

    when I insert the ‘ and run the page I get a different error.

    Error establishing a database connection.
    This either means that the username and password information in your wp-config.php file is incorrect or that contact with the database server at localhost could not be established. This could mean your host’s database server is down.

    I notice that when the database was created no tables were created.
    I have had this previously and this has resolved itself later in the process.
    Has anyone some suggestions how to fix this problem?

    Many thanks
    John H

    • This topic was modified 11 months, 1 week ago by James Huff. Reason: moved to Localhost Installs since this is a localhost install

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • The easiest way would be to use the WordPress installation routines for the setup. So remove the wp-config.php and call up the domain under which you have your XAMPP accessible in the browser. The setup should then start immediately.

    If you want to go the manual route, you must enter the correct database access data and syntax correctly in wp-config.php.

    define( 'DB_PASSWORD', '-- );

    is incorrect both in terms of content and syntax. Content since — is certainly not a password. And syntactically because the wrong inverted commas are used and none at all is used at the end. That would be correct:

    define( 'DB_PASSWORD', 'enter_your_password' );

    Just replace enter_your_password with the password that you have set up for the database user in your XAMPP.

    Muhammad Bux

    (@muhammadbux)

    <span style=”background-color: rgb(251, 251, 251); color: rgb(50, 55, 60); font-family: "Open Sans", sans-serif; font-size: 14.4px; white-space-collapse: collapse;”>Parse error: syntax error, unexpected identifier “DB_HOST”, expecting “)” in C:\xampp\htdocs\wptest\wp-config.php on line 32.</span>

    When I look at the file with notepad ++ I can see an error on line 29/** Database password */define( ‘DB_PASSWORD’, ‘—- ); no closing ‘

    Sometimes it happens due to XAMPP please check your XAMPP version or reinstall XAMPP. Then try to install wordpress again following Guidlines =>https://developer.www.ads-software.com/advanced-administration/before-install/howto-install/

    threadi

    (@threadi)

    Syntax errors in wp-config.php are not caused by a server tool ??

    Thread Starter johnhardy

    (@johnhardy)

    Very many thanks for all of your information. I have been away so unable to reply, but seem to have had some success with localwp but will further investigate your words of wisdom.

    Regards
    John H

    Thread Starter johnhardy

    (@johnhardy)

    Thanks for your help.
    I still have the same error “Error establishing a database connection”
    I have recreated the files and database to correct any errors, several times but the error persists.

    I notice that no config file is automaticaly created but
    wp-config-sample.php can be copied and updated to correct this which has been carried out and checked for missing ‘ – items!

    When the database is created no tables are created. Previously tables were created in the database but for some reason , no more.

    I have checked and double checked the database details are correct in config.php.

    PHP version XAMPP Version: 8.1.12

    (Some time ago I purchased some software which carried out the installation but unfortunately they no longer seem to exist.)

    Thanks again

    John H

    If the wp-config.php does not exist, you simply have to call up the domain. The WordPress setup will then start. There you enter the database connection data and WordPress creates the wp-config.php for you. There is normally nothing more to do here.

    Thread Starter johnhardy

    (@johnhardy)

    Well after a long learning struggle the problem was eventually sorted out. I think when I was entering the final database fields the problem was there but I am not completely sure of what I was doing wrong. The tables have also appeared in the database.
    Thanks for the help and your interest.

    John H

    Thread Starter johnhardy

    (@johnhardy)

    Thanks Threadi.

    I will keep this url in my files and if needed I will the try it out. I am becoming more used to the config.php file now.

    Regards

    John H

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Error establishing a database connection.’ is closed to new replies.