來源:互聯網
上載者:User
關鍵字
php
hhvm
mediawiki
nginx
環境:Debian 8 64bit,openresty(nginx加強版)1.9.7.4,HHVM 3.13.1,mediawiki 1.26.2最新版
遇到的問題:HHVM 無法解析php5,瀏覽器會直接下載。(比如訪問wiki首頁時)
相關配置:
/etc/hhvm/php.ini
; php optionssession.save_handler = redissession.save_path = "tcp://localhost:6379"session.gc_maxlifetime = 1440memory_limit = 256M; hhvm specifichhvm.log.level = Warninghhvm.log.always_log_unhandled_exceptions = truehhvm.log.runtime_error_reporting_level = 8191hhvm.mysql.typed_results = false
/etc/hhvm/server.ini
; php optionspid = /var/run/hhvm/pid; hhvm specifichhvm.server.port = 9000hhvm.server.user = wwwhhvm.server.group = wwwhhvm.server.type = fastcgihhvm.server.default_document = index.php,index.php5hhvm.log.use_log_file = truehhvm.log.file = /var/log/hhvm/error.loghhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc
/etc/nginx/hhvm.conf
location ~ \.(hh|php5|php)$ { fastcgi_keep_conn on; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;}
/etc/nginx/nginx.conf
省略多餘部分include servers.conf
/etc/nginx/servers.conf
server{ listen 80; server_name baike.mpcblab.com; root /var/www/html/baike; index index.php index.php5 index.html index.htm; set_real_ip_from 127.0.0.1; real_ip_header X-Forwarded-For; #limit_conn perip 3; #limit_conn perserver 20; #limit_rate 1024k; location / { # rewrite ^/([^?]*)(?:\?(.*))? /index.php5?title=$1&$2 last; //就是這行,注釋了能訪問,不注釋就不會解析而是直接下載,但調用.php5檔案的地方,比如“特殊頁面:版本”還是會直接下載 } include hhvm.conf;}
其他的Web服務都正常使用沒有問題,只有mediawiki不行
回複內容:
環境:Debian 8 64bit,openresty(nginx加強版)1.9.7.4,HHVM 3.13.1,mediawiki 1.26.2最新版
遇到的問題:HHVM 無法解析php5,瀏覽器會直接下載。(比如訪問wiki首頁時)
相關配置:
/etc/hhvm/php.ini
; php optionssession.save_handler = redissession.save_path = "tcp://localhost:6379"session.gc_maxlifetime = 1440memory_limit = 256M; hhvm specifichhvm.log.level = Warninghhvm.log.always_log_unhandled_exceptions = truehhvm.log.runtime_error_reporting_level = 8191hhvm.mysql.typed_results = false
/etc/hhvm/server.ini
; php optionspid = /var/run/hhvm/pid; hhvm specifichhvm.server.port = 9000hhvm.server.user = wwwhhvm.server.group = wwwhhvm.server.type = fastcgihhvm.server.default_document = index.php,index.php5hhvm.log.use_log_file = truehhvm.log.file = /var/log/hhvm/error.loghhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc
/etc/nginx/hhvm.conf
location ~ \.(hh|php5|php)$ { fastcgi_keep_conn on; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;}
/etc/nginx/nginx.conf
省略多餘部分include servers.conf
/etc/nginx/servers.conf
server{ listen 80; server_name baike.mpcblab.com; root /var/www/html/baike; index index.php index.php5 index.html index.htm; set_real_ip_from 127.0.0.1; real_ip_header X-Forwarded-For; #limit_conn perip 3; #limit_conn perserver 20; #limit_rate 1024k; location / { # rewrite ^/([^?]*)(?:\?(.*))? /index.php5?title=$1&$2 last; //就是這行,注釋了能訪問,不注釋就不會解析而是直接下載,但調用.php5檔案的地方,比如“特殊頁面:版本”還是會直接下載 } include hhvm.conf;}
其他的Web服務都正常使用沒有問題,只有mediawiki不行
自己解決了,參考官方文檔:HHVM Doc
在server.ini加上:hhvm.php_file.extensions["php5"] = ".php5"
重啟HHVM即可。
為什麼不用php7呢趕緊拋棄hhvm吧。。。