Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Lulu Lau
Lulu Lau
2,834 Points

WORDPRESS modifying php.ini and .htaccess for localhost with MAMP

I'm having a heck of a time configuring my MAMP localhost to fit the recommended server settings for the Wordpress theme I'm using. I'm using MAMP, not MAMP Pro. I need to increase the values to at least this:

Snippet for php.ini

memory_limit = 256M 
post_max_size = 128M 
upload_max_filesize = 32M  
max_input_vars = 3000
max_execution_time = 300​

Snippet for .htaccess

  php_value memory_limit 256M
  php_value post_max_size 128M
  php_value upload_max_filesize 32M
  php_value max_input_vars 3000
  php_value max_execution_time 300​ 

I was able to resolve memory_limit, post_max_size, and upload_max_filesize. Here's how I did it (in case I need to do it again and forget what I did):

  • With MAMP server running, I opened the WebStart page, then went to Tools > phpMyAdmin
  • Under Web Server, I found out which PHP version it's using (this is important because my MAMP\conf directory had almost three dozen versions and I didn't know in which version to alter the php.ini file)
  • I went to the noted MAMP\conf directory and Ctrl+F for "memory_limit" "post_max_size" etc and changed the values
  • I saved the file, stopped and restarted my MAMP servers, refreshed my Wordpress Status page
  • I saw that the values I changed were no longer red (in warning), so success

How do I update max_input_vars and max_execution_time? Do I just stick both of those in there somewhere?

Where/which is the correct .htaccess file?

Please halps! Thanks so much!

ADDENDUM: I found my .htaccess file in the root folder of my Wordpress site. I have no idea what to do from here. Do I just paste in everything in the block? It looks like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /localwpLLM.dev/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /localwpLLM.dev/index.php [L]
</IfModule>

# END WordPress