1

I am using OSX Yosemite and I have installed MAMP. I am able to upload my files to htdocs and view them on the localhost:8888, however when I make changes to a php file, the changes won't show up, only the original content of the php file remains.

The original file says: and I see in the localhost : 8888 Hello World. However, when changing it to the following: -- -- the localhost still prints: Hello World! and not the changes to Hello Everyone!!! as the code specifies.

Can you please help, Thanks!

Joanna K.
  • 33
  • 1
  • 9
  • Can you post some code ? – Maximus2012 Mar 16 '15 at 18:06
  • I advise you to use brew I was using MAMP too but when I discovered powers of homebrew I was blown away give it a try at least. http://stackoverflow.com/questions/26493762/yosemite-php-gd-mcrypt-installation It is going to make you better at understanding apache2 and php and modules... – Kyslik Mar 16 '15 at 19:59
  • First: edit your question and insert the following informations: your file location path (complete path), your htdocs path and how you "upload your file to htdocs". – Patrick Maciel Mar 20 '15 at 19:36

3 Answers3

2

Open MAMP, go to Preferences then PHP tab and set Cache option to OFF

JC Sama
  • 2,214
  • 1
  • 13
  • 13
0

I'm assuming the code is cached. You need to disable OPCache. If you're using MAMP PRO you can to this in the settings. Otherwise you need to edit the php.ini yourself.

Edit /Applications/MAMP/bin/php/php5.x.x/conf/php.ini by adding ; as first character to all OPcache related lines. Where 5.x.x needs to be the folder with your used PHP version. You can find out which version you're using by adding phpinfo(); to your index.php file.

Alternatively you can try adding opcache_reset(); in your file before echo "Hello World!" in your index.php.

dersvenhesse
  • 6,276
  • 2
  • 32
  • 53
0

I also suspect OPCache needs to be disabled or reset in your file. I also just upgraded to OS X Yosemite and I'm using MAMP and had a very similar problem. Whenever I edited my php code and refreshed the page, the changes wouldn't take immediate effect. There was about a 3-5 minute delay.

After determining it wasn't an issue with FireFox or Chrome cache, I started searching for MAMP settings as potential culprits. Adding opcache_reset(); to the top of the page fixed the issue immediately. I recommend trying this yourself next to see if anything changes.

RVD
  • 100
  • 1
  • 9