• I’ve migrated a whole bunch of sites from a production webserver down to my local machine running MAMP/localhost but i recently did one that created something bizarre, i’m curious if anyone can tell me what is going on.

    I did these steps to create my localhost: (1) exported production database, (2) downloaded complete extract of public_html from production to local machine, (3) created my localhost directory (MAMP/htdocs/appname/public_html, (4) copied production files there, (5) created the database, imported the export from step #1, created production user in phphmyadmin, (6) stopped/started MAMP.

    Now, when i try to open up the homepage via ‘localhost:8888’, instead of getting the homepage of the site, it instead downloads a file with this content:

    <?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 __DIR__ . '/wp-blog-header.php';

    I’ve never seen this before. No errors in any logs, nothing to indicate a problem, though there obviously IS one. Can anyone shed some light on where i may have gone awry here?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Seeing the raw PHP code means the PHP code isn’t getting executed. Which would suggest there’s something wrong with your PHP installation.

    But then you also mentioned running phpMyAdmin — which (obviously) requires PHP.

    Put a basic phpinfo() file in the root: MAMP/htdocs/appname/public_html/

    Does it execute?

    Thread Starter jlanpheer

    (@jlanpheer)

    Thanks for the reply! Interesting…. i didn’t think there was a php problem because i can get into phpMyAdmin with no issues. However, loading the phpinfo.php file via the browser results in the same thing: it downloads the file. So, the issue MUST be with the PHP installation somehow, would you agree? I’m curious how that could be the case, yet i can run phpmyadmin…..

    thank you for the suggestion!

    [edit: The php error log itself contains NO errors at all. I find that ‘odd’ if php is the culprit. [end edit]

    • This reply was modified 2 years, 1 month ago by jlanpheer. Reason: Added more info
    Moderator threadi

    (@threadi)

    This is due to a misconfiguration in MAMP. There are some tips on this on the web, have a look at them:
    https://stackoverflow.com/questions/39515920/receiving-download-popup-when-trying-to-access-any-php-files-using-mamp
    https://forum.getkirby.com/t/mamp-keeps-downloading-website-instead-of-launching-it/18374

    phpmyadmin could work as it runs via a different port or Vhost. That would narrow down the search for you.

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

The topic ‘Moving production to localhost’ is closed to new replies.