HappyHands31
HappyHands31

Reputation: 4101

Forbidden Error When Running WP Theme in MAMP PRO

I cloned a private repository for a WordPress theme. The repository includes a wp-content folder (plus five other files - .png's, an .ico, and an .md). I'm trying to run the contents of this repository - the WordPress theme - locally on my Mac using MAMP PRO.

Running the repository should look like this: http://dynamic.switzercreative.com/

But I'm getting this:

enter image description here

In MAMP PRO, I have Apache and MySQL running:

enter image description here

You can also see that MySQL is configured to use port 8889.

Going into phpMyAdmin --> Database Name (on the left side) --> Privileges

enter image description here

I make sure that the username matches what I have in the wp-config.php file, and it does (line 3):

define( 'DB_USER', 'database_username' );

I also notice that under privileges, 'Grant' is set to no for this username. I'm guessing I need to edit this?

enter image description here

Should I be editing username privileges - is that what's causing this error message?

EDIT: I went ahead and hit "edit privileges" and checked "grant" under administration. That made the username display "all privileges", just like the other usernames

enter image description here

enter image description here

But I'm still getting the forbidden error message when typing localhost:8888/theme_name_wpe into the URL.

enter image description here

EDIT 2: I also considered that this might be a permissions issue. I followed the instructions in the second answer of this article - I cd'd into homefolder/wp-content/themes and ran sudo chown -R username:groupname theme_name to hopefully give the theme its necessary permissions. I'm still getting the same result in the browser, though.

EDIT 3: After checking the error log, I saw that the error message said:

Failed to load resource: the server responded with a status of 403 (Forbidden)

That led me to this article. Following the instructions in the top-rated answer, I cd'd into the root directory (the folder 'dynamictransit_wpe' that's sitting on my Desktop) and ran the following commands:

find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

I'm still getting the same error, but the error message looks different now - like this:

enter image description here

Was I supposed to cd into the theme folder? (dynamictransit_wpe --> wp-content --> themes --> theme)

EDIT 4: After googling '403 forbidden httpd - t', I found this article, which suggests that I need to edit the httpd.conf file. At line 150 in the file, I found:

User #-1
Group #-1

I thought that I would need to change these to match the Database username / group name, but these changes this yielded no effect. I also tried a variety of other User and Group possibilities, including setting User to the Username for my Mac - still nothing.

Upvotes: 1

Views: 1575

Answers (2)

HappyHands31
HappyHands31

Reputation: 4101

I'm not exactly sure which one of these adjustments caused it to work, but now going to "localhost/" renders the website:

1.) Changed username and password in wp-config.php to "root", like this:

define( 'DB_USER', 'root' );
define( 'DB_PASSWORD', 'root' );

(MAMP / MAMP PRO automatically sets "root" as the username and password for a database, so make sure that they are set correctly)

2.) Also make sure that the database name, host, home, and siteurl match:

define( 'DB_NAME', 'dynamic_transit' );
define( 'DB_HOST', 'localhost' );
define('WP_HOME','http://dynamic');
define('WP_SITEURL', 'http://dynamic');

3.) Make sure that the host name is set to localhost:

enter image description here

4.) Create an .htaccess file within your root folder (the folder that contains wp-content, wp-admin, and wp-includes. Leave that file blank.

5.) Make sure the username for Ports --> "Run Servers As:" is set to the username for your computer:

enter image description here

6.) Restart servers and go to localhost/ in the URL. If it's a WordPress site you should be able to go to localhost/wp-admin and enter your WordPress username and password to login.

Upvotes: 1

Jorge Vazquez
Jorge Vazquez

Reputation: 99

A 403 means that something about the server's configuration is blocking your access to that particular file. In your case, since you are trying to access the site, the file is going to be index.php

From everything I can see in your documentation above, you already have WP installed correctly and the only potential problems I see are:

  • MAMP may not be running it's own Apache server. I say MAY because I don't have enough information to make that determination but it is a possibility.
  • Your Apache configuration forbids access to your web root. Did you create a folder specifically for this app in MAMP? If so, make sure that the root folder has 755 permissions and is owned by the web server's user and group.
  • Check your httpd.conf file and make sure that AllowOverride is set to All.
  • Ensure you don't have a funky .htaccess file somewhere that is blocking access to your site. When in doubt, rename the file to something like htaccess.txt and see if your site loads.

Upvotes: 1

Related Questions