Why is PHP cache similar to that in osx vagrantcentos6lnmp?

Source: Internet
Author: User
Tags apc sendfile
For example, after Vagrant file synchronization is set up, after I modify the file on OSX, I will immediately go to the vagrantcentos environment to view the file content, which is already updated, I found that the slow synchronization on the Internet does not seem to exist, but I still use the old version to access this PHP file through the http browser... for example, after Vagrant file synchronization is set up, after I modify the file on OSX, I will go to the vagrant centos environment to view the file content, which is already updated, I found that the slow synchronization on the Internet does not seem to exist, but I still use the old version to access this PHP file via the http browser, it takes about 10 seconds to refresh the latest version (no similar restart operations were performed in centos6)

Has anyone ever encountered this?

In addition, the PHP file is very simple, that is, an echo print statement for testing, without any logic

Reply content:

For example, after Vagrant file synchronization is set up, after I modify the file on OSX, I will go to the vagrant centos environment to view the file content, which is already updated, I found that the slow synchronization on the Internet does not seem to exist, but I still use the old version to access this PHP file via the http browser, it takes about 10 seconds to refresh the latest version (no similar restart operations were performed in centos6)

Has anyone ever encountered this?

In addition, the PHP file is very simple, that is, an echo print statement for testing, without any logic

Is php enabled with bytecode cache?

Check the php version. opcache is enabled by default in the new version.

Modify the web server configuration file as a static file

Apache: Change EnableSendfile on to EnableSendfile off nginx: Change sendfile on to sendfile off;

Php can be disabled during development, such as apc, opcode, and xcache.

Notes

Problem 1) When Apache/Nginx is used, modifications may occur, but the page refresh is still the old file, which is caused by the static file cache. You need to modify the Apache/Nginx configuration file in the virtual machine:

# Nginx configuration sendfile off # apache configuration EnableSendFile off

Problem 2: The error "2222 port in use" is prompted when multiple VMS are started"

Solution: (reference: Vagrant SSH errors with multiple VMs: Port 2222 in use)

config.vm.network "forwarded_port", guest: 22, host: 2220 ,id: 'ssh'

Problem 3: If php code is also cached, disable apc and opcode (opcode is enabled by default in php5.5 and later versions)

Copyright: This article is the original author article, the original permanent address: http://www.vincentguo.cn/default/26.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.