I've checked this issue out with the Wordpress forum and the consensus is that it's a PHP issue, but i just don't see one, so i'm looking for ideas/insight.
I'm running MAMP 6.8 on my localhost and have 6-8 other client Wordpress installations that i can start up at anytime without issue, all running php 7.4.33 using Apache port 8888 and MySQL port 3306. Now, i am attempting to create a new instance but after running the standard WP installation, when i attempt to open the homepage in the browser (http://localhost:8888), rather than opening the page, the browser downloads the PHP code it is attempting to run. I can't figure it out. I've put a phpinfo.php file in the base directory of my installation and it pulls up all the PHP config info that you'd expect. I get the same result when i click on Webstart from the MAMP interface. I don't see any problems at all and i don't see anything in the Apache logs or PHP error logs.
Can anybody offer any insight? I've read a variety of posts indicating that the problem could be the .htaccess file, i've tried several things to no avail. Can anybody suggest something i might try? What baffles me is that this configuration is exactly the same as a number of other WP installations on the same machine that work just fine. Hence my 'bafflement'....
Many thanks for any ideas!
PHP or .htaccess issue with new Wordpress installation.
Re: PHP or .htaccess issue with new Wordpress installation.
I thought i'd include the php file that gets downloaded when i attempt to open the webpage on localhost. This is the code, the referenced file certainly exists within the installation. I guess the only thing that stands out is whether '__DIR__' is defined or not.
<?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';
<?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';
-
- Posts: 7
- Joined: Wed Jul 10, 2024 1:30 pm
Re: PHP or .htaccess issue with new Wordpress installation.
jlanpheer,
I don't run Wordpress via MAMP often so I'm not exactly experienced with what you're trying to accomplish. Because the phpinfo runs as expected I would think this is a .htaccess or WP configuration issue. That being said ...
I would check few things:
1) Do you use the "Hosts" feature of MAMP? If so, are the Hosts settings for this new WP site the same as the other WP sites that work? The PHP Mode in the PHP configuration pane (e.g., Module vs CGI) could make a difference.
2) My first thought was the .htaccess file. Is the .htaccess file for the new WP site the same as for the other WP sites that work? If not, are the differences between the new WP site's .htaccess the same as the differences between the .htaccess files for the working WP sites?
An errant path name or variable in the .htaccess file of the new WP site could cause issues.
3) What are the values of the "siteurl" and "home" entries in the wp_options table for the new WP site and one of the working WP sites? Are they the same (other than any obvious differences due to installation site names)?
4) Are you using the same version of PHP for this new WP site as you are for the others that are working? If it's a different version of PHP the issue could be a different or missing configuration setting.
Compare the results from the phpinfo in the new WP site's installation with one from a working WP installation.
WSG
I don't run Wordpress via MAMP often so I'm not exactly experienced with what you're trying to accomplish. Because the phpinfo runs as expected I would think this is a .htaccess or WP configuration issue. That being said ...
I would check few things:
1) Do you use the "Hosts" feature of MAMP? If so, are the Hosts settings for this new WP site the same as the other WP sites that work? The PHP Mode in the PHP configuration pane (e.g., Module vs CGI) could make a difference.
2) My first thought was the .htaccess file. Is the .htaccess file for the new WP site the same as for the other WP sites that work? If not, are the differences between the new WP site's .htaccess the same as the differences between the .htaccess files for the working WP sites?
An errant path name or variable in the .htaccess file of the new WP site could cause issues.
3) What are the values of the "siteurl" and "home" entries in the wp_options table for the new WP site and one of the working WP sites? Are they the same (other than any obvious differences due to installation site names)?
4) Are you using the same version of PHP for this new WP site as you are for the others that are working? If it's a different version of PHP the issue could be a different or missing configuration setting.
Compare the results from the phpinfo in the new WP site's installation with one from a working WP installation.
WSG