osx下vagrant centos6 lnmp环境下,为什么PHP也有类似缓存的情况?
如题,设置了Vagrant文件同步,我在OSX上修改文件以后,马上去vagrant centos环境下去查看文件内容,已经是更新以后的内容,发现网上所说的同步慢貌似不存在,但是我用浏览器 http访问这个PHP文件的时候还是老版本的,大概需要10秒左右才能刷新出最新的(没有在centos6中做任何类似重启等操作)
请问有人碰到过么?
另外说明下PHP文件很简单,就是一个echo打印语句做测试,无任何逻辑
回复内容:
如题,设置了Vagrant文件同步,我在OSX上修改文件以后,马上去vagrant centos环境下去查看文件内容,已经是更新以后的内容,发现网上所说的同步慢貌似不存在,但是我用浏览器 http访问这个PHP文件的时候还是老版本的,大概需要10秒左右才能刷新出最新的(没有在centos6中做任何类似重启等操作)
请问有人碰到过么?
另外说明下PHP文件很简单,就是一个echo打印语句做测试,无任何逻辑
php 开字节码缓存了吧?
看看php 版本,新版默认开启opcache 了
修改 web 服务器配置文件,为静态文件
<code> apache: 将 EnableSendfile on 改为 EnableSendfile off nginx: 将 sendfile on; 改为 sendfile off;</code>
php 开发时可以禁用,apc,opcode,xcache等。
注意事项
问题一)使用 Apache/Nginx 时会出现诸如图片修改后但页面刷新仍然是旧文件的情况,是由于静态文件缓存造成的。需要对虚拟机里的 Apache/Nginx 配置文件进行修改:
<code>#nginx配置 sendfile off #apache 配置 EnableSendFile off </code>
问题二:启动多个虚拟机提示错误“2222 端口 in use”
解决办法:(参考文章:Vagrant SSH errors with multiple VMs: Port 2222 in use)
<code>config.vm.network "forwarded_port", guest: 22, host: 2220 ,id: 'ssh' </code>
问题三:如果遇到 php 代码也感觉被缓存起来了,请关闭apc,opcode(从php5.5及以后版本默认开启opcode)
版权声明:本文为博主原创文章,原文永久地址:http://www.vincentguo.cn/default/26.html

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

Working with database in CakePHP is very easy. We will understand the CRUD (Create, Read, Update, Delete) operations in this chapter.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

In this chapter, we are going to learn the following topics related to routing ?

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Validator can be created by adding the following two lines in the controller.
