Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

php - MAMP: reloading pages is very slow

On a basic installation of MAMP, I'm building an application with CodeIgniter locally (MacBook Pro, Core2Duo 2,26 GhZ, 4GB RAM).

My problem is, that when I reload a page, it does load very slow, even slower than when I put on a web server.

It's strange that it only loads slow when I reload the page, not when I click on a link in the application itself.

The application uses a MySQL database, but even when I reload a page that doesn't make MySQL queries, it's so slow, that it takes about 10 seconds to load a page.

I read on http://forum.mamp.info/viewtopic.php?f=6&t=14081 that I could try to change the server name from .local to .dev. But I don't know how to do that and didn't find anything when I googled it.

What could I do about it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The '.local' domains conflict with Bonjour, which treats anything with a '.local' TLD as a Bonjour server.

I found the answer here: http://www.bram.us/2011/12/12/mamp-pro-slow-name-resolving-with-local-vhosts-in-lion-fix/, and that post refers to https://discussions.apple.com/message/15834652#15834652.

The solution is to, as Jon said, put a ::1 address in/etc/hosts.

::1 localhost   example.local    anotherexample.local

Unfortunately, MAMP Pro will delete the entry when it restarts so put a tab (not spaces) between the IP and each of the hosts.

The alternative is to put a different TLD - .dev or something like that.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...