Mamp localhost resolving very slowly

烈酒焚心 提交于 2019-12-07 05:28:26

问题


When I make local changes to my PHP / WordPress website, the localhost does not seem to update for 20-30 minutes.

I'm on Mac OSX 10.8.4 and using MAMP Pro. I have two sites that I have created separate host entries for, let's call them mysite1.dev and mysite2.dev.

Here is my MAMP Server configuration:

Apache: 80
MySQL: 3306
SSL: 443

I saw this article ( How can I eliminate slow resolving/loading of localhost/virtualhost (a 2-3 second lag) on Mac OS X Lion? ) on the Bonjour conflicts and edited my /private/etc/hosts file with the suggestions in this article:

  1. I changed the host names from mysite1.localhost to mysite.dev because it sounds like the conflict is with .local names - DID NOT WORK

  2. I updated the Hosts file to have separate ::1 addresses - DID NOT WORK:

    ::1 <tab> mysite1.dev
    ::1 <tab> mysite2.dev
    
  3. I tried putting all of my host entries onto one line - also didn't work:

    127.0.0.1 localhost mysite1.dev mysite2.dev
    ::1 localhost
    fe80::1%lo0 localhost
    

It seems like MAMP Pro overwrites the hosts file any time I restart the server.

I would be SUPER grateful for any help you can offer.


回答1:


Change MAMP cache to OPcache. It worked for me




回答2:


I had the same problem and found the solution on this post: MAMP time between seeing live changes

The instructions, which I followed:

The solution is uncommenting lines in the php.ini file, which can be found in

/{MAMP Directory}/bin/php/php5.5.3/conf/php.ini

Comment out Opcache:

[OPcache]
;zend_extension="/Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts-20121212/opcache.so"
;  opcache.memory_consumption=128
;  opcache.interned_strings_buffer=8
;  opcache.max_accelerated_files=4000
;  opcache.revalidate_freq=60
;  opcache.fast_shutdown=1
;  opcache.enable_cli=1

Documentation ( yes it started in 5.5 ):

http://www.php.net/manual/en/intro.opcache.php




回答3:


I had similar problems running php 5.5.3. After I changed back to 5.4.19 it worked.

You can change the version in the MAMP GUI. You might have to rename your 5.5.3 folder to 5.5.X for 5.4.19 to show up in the GUI. The php folders are placed at: Applications/MAMP/bin/php




回答4:


For me, changing back to MAMPS standard port settings did the trick.




回答5:


MAMP's default ports are non-standard. When I switched to standard ports (80 for Apache & 443 for SSL), it sped up dramatically.

I'm not sure if this is what Paul Bakker did, or if he switched the other way.

I'm using MAMP Pro 4.2, PHP 7.1.6, Apache, OS X 10.11.6.




回答6:


It was really hard, but I found a solution that it works in my environment:

  • MAMP 4.2.1
  • PHP 5.6.31

SETTINGS left menu > Ports settings > Run servers as: > Change it to "Unix Users" option.




回答7:


Changing from PHP 7 to 5 fixed mine.




回答8:


I'm not sure about Mamp, however, I use php -S 0.0.0.0:4444 to spin up a local server. Its response got very slow after moving to Mojave.

I was able to fix it by updating /etc/hosts file with

::1             localhost YouMacName.local
127.0.0.1       localhost YouMacName.local

You can get YourMacName.local by running in terminal:

$ hostname


来源:https://stackoverflow.com/questions/18537887/mamp-localhost-resolving-very-slowly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!