Recently wrote a symfony program, the first is directly under the Mac through the console Server:run command to start a simple Web server to access, but the Mac itself comes with PHP does not memcached extension, so put this program into the vagrant , but found that the speed of the visit is very slow, a very simple page also need to consume about 10 seconds, so search for a bit, found before someone encountered the same problem.
Symfony program slow solution in vagrant environment
Several scenarios are listed in this article: http://leo108.com/pid-2196.asp
- Use vagrant1.2 version (visually inappropriate, now all 1.7+)
- mount a directory using NFS
- The VBox Guest Additions version in the Vagrant virtual machine is consistent with the virtual box version (my current environment is consistent)
- Using the Opcache extension (APC is already installed in my current environment)
- Turn off Xdebug and xphrof extensions (my current environment is off)
Look at this situation, only try the NFS mode, according to Vagrant's document configuration, fortunately OS X comes with NFSD, save the installation of trouble, only need to modify vagrantfile.
Symfony
Add two rows to the Vagrantfile:
Http://leo108.com/pid-2196.asp
Config.vm.network:p rivate_network, type::d hcpconfig.vm.synced_folder ".", "/vagrant", type: "NFS"
Then restart the vagrant virtual machine vagrant Reload