• Resolved Dvelop IT

    (@dvelop-it)


    Hi there,

    I’ve just setup MAMP to edit a WordPress website locally (the web hosted version works fine)

    Originally had error establishing database connection error – fixed that after reading online by adding “AddType x-mapp-php5 .php” to .htaccess file.

    Now the only thing showing is:

    <?php
    /**
    * Front to the WordPress application. This file doesn’t do anything, but loads
    * wp-blog-header.php which does and tells WordPress to load the theme.
    *
    * @package WordPress
    */

    /**
    * Tells WordPress to load the WordPress theme and output it.
    *
    * @var bool
    */
    define(‘WP_USE_THEMES’, true);

    /** Loads the WordPress Environment and Template */
    require( dirname( __FILE__ ) . ‘/wp-blog-header.php’ );

    Any idea how to fix or whats going on?

Viewing 6 replies - 1 through 6 (of 6 total)
  • If that’s showing in that format it means that you’ve done something to disable PHP. I’d recommend removeing what you added to the .htaccess file as that seems to be all that you did to make it happen.

    Oh, and the database error means that PHP is running, but you have invalid database connection credentials in your wp-config.php file, so you should investigate that instead of doing any further changes.

    Thread Starter Dvelop IT

    (@dvelop-it)

    Thanks for your help – I have removed the .htaccess code which as you mentioned will show the previous database error. However the wp-config file is exactly the same credentials as the version on the live hosting environment so it cant be an issue with the user/password details. I am not familiar with MAMP or local hosting environments so not sure if there is anything different I need to do with linking the database? I have followed the MAMP instructions and have placed the .sql file in ../db/mysql/

    Anything I’m missing?

    However the wp-config file is exactly the same credentials as the version on the live hosting environment so it cant be an issue with the user/password details

    That’s most likely the problem. Does your host allow remote access to the database server? some do, but most don’t, and if yours doesn’t you will get that error message from any machine outside of the actual hosting server.

    Also, you will need to copy the database anyway. With WordPress, the URL’s used around the site are stored around the database, so you will need to set those to your local environment before you’ll be able to do anything locally.

    Thread Starter Dvelop IT

    (@dvelop-it)

    Hi I have simply copied the database file to the directory specified in MAMP ../db/mysql

    how do I go about modifying the paths to get the wordpress install ‘talking’ to the database in its new location. (sorry first time trying to install locally so its quite different for me) Thanks so much for your help.

    Copying raw database files doesn’t normally work successfully. Most times you’d want to use something like phpMyAdmin to export and import the database between systems.

    Thread Starter Dvelop IT

    (@dvelop-it)

    Thanks for your help – got it sorted by importing through phpMyAdmin. Cheers.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘MAMP PHP errors’ is closed to new replies.