❶ php5.4怎么开启php的opcache模块
1、本文假设读者已经有了一定的php编程基础,并且了解php环境配置,熟悉wamp集成开发环境。
2、下载php_opcache.dll文件,必须下载和php兼容的版本!(比如我的php5.4.16是vc9编译的,这个dll文件也必须是vc9编译的版本)。下载地址:http://pecl.php.net/package/ZendOpcache
3、将php_opcache.dll放进php/ext目录下(比如:C:wampinphpphp5.4.16ext)。
4、打开php.ini,添加如下配置(注意路径要修改成你自己的):
zend_extension = "c:/wamp/bin/php/php5.4.16/ext/php_opcache.dll"
extension = php_opcache.dll
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
5、重启wamp。
6、查看opcache是否开启成功,可以通过phpinfo();函数查看opcache的相关信息。
注意事项
开启opcache后,更改PHP代码,程序运行结果不会立刻有变化(有缓存嘛),缓存时间过期了就更新了。
如果想立刻看到更新后的效果,可以重启下apache服务器。
建议开发环境下,关闭zend opcache功能,便于调试。
如有更多问题去后盾网论坛问题救助专区,希望我的回答对你有帮助!
❷ 求救,为什么PHP 开启opcache后,访问502 Bad Gateway错误
502一般是php运行出现问题,或者是opcache在缓存文件时,文件有错误
❸ 求救,为什么PHP 开启opcache后,访问502 Bad Gateway错误
应该用php5.5以上的版本开启opcache,5.4以前的版本opcache在生产环境下需要进行严格测试,因为有问题,我就遇到过5.4.x下开启opcache后phpcms不能正常安装,安装上了程序运行也有问题。。
❹ opcache php5.2支持吗
提醒大家php5.5下开启opcache可以这样做:
打开php.ini文件, 在最底部增加如下配置:
[opcache]
zend_extension = “D:\xampp\php\ext\php_opcache.dll”
opcache.memory_consumption=1024
opcache.optimization_level=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4096
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable=1
opcache.enable_cli=1
这样操作的话 就能成功开启opcache了
❺ mac brew 怎么安装msql 5.5
Brew 是 Mac 下面的包管理工具,通过 Github 托管适合 Mac 的编译配置以及 Patch,可以方便的安装开发工具。 Mac 自带ruby 所以安装起来很方便,同时它也会自动把git也给你装上。官方网站: brew/Homebrew/homebrew/go/install)" 使用以下方法可以查看brew是否安装成功,以及目前的版本: liondeMacBook-Pro:~ lion$ brew -v Homebrew 0/project/machomebrew/Bottles/curl-7/freetds/stable/freetds-0/project/machomebrew/Bottles/gmp-6.0.0a.mavericks.bottle.tar.gz ######################################################################## 100.0% ==> Pouring gmp-6.0.0a.mavericks.bottle.tar.gz /usr/local/Cellar/gmp/6.0.0a: 15 files, 3.2M ==> Installing php55 ==> Downloading /get/php-5.5.15.tar.bz2/from/this/mirror Already downloaded: /Library/Caches/Homebrew/php55-5.5.15 ==> ./configure --prefix=/usr/local/Cellar/php55/5.5.15 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/5.5 -- ==> make ==> make install ==> /usr/local/Cellar/php55/5.5.15/bin/pear config-set php_ini /usr/local/etc/php/5.5/php.ini ==> Caveats The php.ini file can be found in: /usr/local/etc/php/5.5/php.ini ✩✩✩✩ PEAR ✩✩✩✩ If PEAR complains about permissions, 'fix' the default PEAR permissions and config: chmod -R ug+w /usr/local/Cellar/php55/5.5.15/lib/php pear config-set php_ini /usr/local/etc/php/5.5/php.ini ✩✩✩✩ Extensions ✩✩✩✩ If you are having issues with custom extension compiling, ensure that you are using the brew version, by placing /usr/local/bin before /usr/sbin in your PATH: PATH="/usr/local/bin:$PATH" PHP55 Extensions will always be compiled against this PHP. Please install them using --without-homebrew-php to enable compiling against system PHP. ✩✩✩✩ PHP CLI ✩✩✩✩ If you wish to swap the PHP you use on the command line, you should add the following to ~/.bashrc, ~/.zshrc, ~/.profile or your shell's equivalent configuration file: export PATH="$(brew --prefix homebrew/php/php55)/bin:$PATH" ✩✩✩✩ FPM ✩✩✩✩ To launch php-fpm on startup: * If this is your first install: mkdir -p ~/Library/LaunchAgents cp /usr/local/Cellar/php55/5.5.15/homebrew.mxcl.php55.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php55.plist * If this is an upgrade and you already have the homebrew.mxcl.php55.plist loaded: launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php55.plist cp /usr/local/Cellar/php55/5.5.15/homebrew.mxcl.php55.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php55.plist The control script is located at /usr/local/Cellar/php55/5.5.15/sbin/php55-fpm Mountain Lion comes with php-fpm pre-installed, to ensure you are using the brew version you need to make sure /usr/local/sbin is before /usr/sbin in your PATH: PATH="/usr/local/sbin:$PATH" You may also need to edit the plist to use the correct "UserName". Please note that the plist was called 'homebrew-php.josegonzalez.php55.plist' in old versions of this formula. To have launchd start php55 at login: ln -sfv /usr/local/opt/php55/*.plist ~/Library/LaunchAgents Then to load php55 now: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php55.plist ==> Summary /usr/local/Cellar/php55/5.5.15: 477 files, 43M, built in 3.9 minutes 过程中如果出现configure: error: Cannot find OpenSSL's <evp.h>这样的错误,请执行以下命令,将xcode进行更新: xcode-select --install 在PHP5安装完成的提示中写到,如何进行PHP5和mac自带的php以及php-fpm替换,执行以下命令后,我们可以看到当前的php版本已经是最新的了: liondeMacBook-Pro:~ lion$ echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bash_profile liondeMacBook-Pro:~ lion$ echo 'export PATH=/usr/sbin:$PATH' >> ~/.bash_profile liondeMacBook-Pro:~ lion$ echo 'export PATH=/usr/local/sbin:$PATH' >> ~/.bash_profile liondeMacBook-Pro:~ lion$ source ~/.bash_profile liondeMacBook-Pro:~ lion$ php -v PHP 5.5.15 (cli) (built: Aug 14 2014 15:37:16) (DEBUG) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies liondeMacBook-Pro:~ lion$ 使用brew search php55-命令,可以查看还有哪些扩展可以安装,然后执行brew install php55-XXX就可以了。 liondeMacBook-Pro:~ lion$ brew search php55- php55-amqp php55-igbinary php55-msgpack php55-runkit php55-varnish php55-apcu php55-imagick php55-mysqlnd_ms php55-scrypt php55-vld php55-augmentedtypes php55-inclued php55-oauth php55-snappy php55-wbxml php55-binpack php55-intl php55-opcache php55-solr php55-xcache php55-blitz php55-ioncubeloader php55-parsekit php55-sphinx php55-xdebug php55-boxwood php55-jsmin php55-pcntl php55-spl-types php55-xhgui php55-chdb php55-judy php55-pdflib php55-ssh2 php55-xhp php55-couchbase php55-leveldb php55-pdo-dblib php55-stats php55-xhprof php55-crypto php55-libevent php55-pdo-pgsql php55-stemmer php55-xmldiff php55-dbase php55-libvirt php55-phalcon php55-sundown php55-yac php55-dbus php55-lz4 php55-proctitle php55-svm php55-yaf php55-dmtx php55-lzf php55-propro php55-swoole php55-yaml php55-ev php55-mailparse php55-protobuf php55-thrift php55-yar php55-gearman php55-mcrypt php55-pspell php55-tidy php55-yaz php55-geoip php55-memcache php55-pthreads php55-timezonedb php55-yp php55-gmagick php55-memcached php55-raphf php55-tokyotyrant php55-yrmcds php55-graphdat php55-midgard2 php55-redis php55-twig php55-zmq php55-htscanner php55-mongo php55-redland php55-uploadprogress php55-zookeeper php55-http php55-mosquitto php55-riak php55-uuid 我安装的是以下php5.5几个扩展: liondeMacBook-Pro:~ lion$ brew install php55-imagick php55-igbinary php55-ev php55-gmagick php55-geoip php55-memcache php55-memcached php55-thrift php55-xdebug php55-sphinx composer 接下来我们测试php-fpm的配置是否正确,以及是否正确启动: #测试php-fpm配置是否正确 liondeMacBook-Pro:bin lion$ php-fpm -t [14-Aug-2014 16:14:30] NOTICE: configuration file /usr/local/etc/php/5.5/php-fpm.conf test is successful liondeMacBook-Pro:bin lion$ php-fpm -c /usr/local/etc/php/5.5/php.ini -y /usr/local/etc/php/5.5/php-fpm.conf -t [14-Aug-2014 16:14:48] NOTICE: configuration file /usr/local/etc/php/5.5/php-fpm.conf test is successful #启动php-fpm liondeMacBook-Pro:bin lion$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php55.plist #查看9000端口是否在运行 liondeMacBook-Pro:bin lion$ lsof -i:9000 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME php-fpm 51241 lion 8u IPv4 0xce9d0f6417637937 0t0 TCP localhost:cslistener (LISTEN) php-fpm 51243 lion 0u IPv4 0xce9d0f6417637937 0t0 TCP localhost:cslistener (LISTEN) php-fpm 51244 lion 0u IPv4 0xce9d0f6417637937 0t0 TCP localhost:cslistener (LISTEN) php-fpm 51245 lion 0u IPv4 0xce9d0f6417637937 0t0 TCP localhost:cslistener (LISTEN) #关闭掉php-fpm进程,再查看9000端口,没有监听了 liondeMacBook-Pro:bin lion$ ps auxgrep php-fpmgrep -v 'grep'awk '{print $2}'xargs kill -9 liondeMacBook-Pro:bin lion$ lsof -i:9000 liondeMacBook-Pro:bin lion$ 设置PHP-FPM开机运行(其实在安装完成的提示中,也有说明): ln -sfv /usr/local/opt/php55/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
❻ php 的 opcache 和最近的 php jit 有什么区别
opcache是用来缓存php在运行中代码生成的opcode。
php jit是php新的编译器,部署php代码的时候需要提前把源码编译成机器能识别的识别码。
目前php社区正权力开发JIT,目前已有Php jit版本。据说php8将完全支持php jit
❼ 求救,为什么PHP 开启opcache后,访问502 Bad Gateway错误
这个我也不太清楚,我推荐你去后盾人那里看看,那里有很多相关的视频教学,一定可以帮到你的
❽ php5.5怎么开启opcache
你好!php5.5下开启opcache可以这样做:
打开php.ini文件, 在最底部增加如下配置:
[opcache]
zend_extension = “D:\xampp\php\ext\php_opcache.dll”
opcache.memory_consumption=1024
opcache.optimization_level=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4096
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable=1
opcache.enable_cli=1
祝你好运!
❾ 求救,为什么PHP 开启opcache后,访问502 Bad Gateway错误
一般都是nginx的网站配置问题,可以看看默认安装之后的default.conf,尽量参考它来新加网站配置,
如果你用了lnmp一键安装包,那你可以看看以下这个教程,如果不是你也可以参考一下,这个教程提供一个不错的解决方案,里面的/etc/init.d
/php-fpmrestart或许并不能重启你的php服务,需要根据你自己的实际情况来修改
❿ php.ini 怎样关闭opcache和xcache组件
如果你打算自己处理验证, 用这个选项禁止 HTTP 验证功能. 值得注意的是任意 vhost 用户都可以安装一个 XCache admin 页面, 如果禁止了内建 HTTP 验证,
则他们亦不需要权限即可访问管理页面. 出于安全考虑, 您应该尽量考虑保留 XCache 内建验证功能, 针对 XCache admin 页面特定地址取消网页服务器的 mod_auth 这个选项仅在 1.2.x 系列有作用, 起始版本 1.2.1