我已经设置了PyroCMS,如下所述: http://docs.pyrocms.com/2.2/manual/setup/environments
我在Htaccess中使用了RewriteCondition来自动确定和设置PYRO_ENV变量:
RewriteCond %{HTTP_HOST} ^dev.xyz.com$
RewriteRule (.*) $1 [E=PYRO_ENV:development]
RewriteCond %{HTTP_HOST} ^test.xyz.com$
RewriteRule (.*) $1 [E=PYRO_ENV:staging]
RewriteCond %{HTTP_HOST} ^xyz.com$
RewriteRule (.*) $1 [E=PYRO_ENV:production]
我没有使用Nginx。
它应该如何运作? 根据您是打开xyz.com(生产)还是test.xyz.com(暂存),它应相应地设置global:environment变量并在database.php中选择正确的数据库连接。
的问题: - 当打开xyz.com(生产网站)时,它显示一些变量“生产”和其他“开发”:
_REQUEST["www_pyrocms_development"] 2MH5lsDV3Cb3YK+6IcCrFaIH6Aeu98rIwKcgAaTcFnQsB5Vwn9ySGb3R3QfNTqvMoJsrfjDXv/PLdfYrVjr/IOREQhQIvsa1E+mozs5gYH6lC1+/mORDm2pN//InQBHTJGQsr3Y5jfzNYjakxXOArMRn2hmt14a18TON0VKMjpKjaBrl2aFx+CjypvIdF0oI4aXrK0HIWjhCl+VTdea4gFQzD6g7RblmKwHoJKCdYRCytWZ8z6y1HT3TQDMUOij3xqCXswrY0GD/bDfVvz16Ru07J8Y1z9v4Ye2hF8z7TiwomPIQgyiP+RSaOAebVRpF103KQvgjJjL5oSaywHiqX7noLEqQRsMjjaZFKMOgIpbtJoilytKby1TrdezhK4cFu/Kq1vTExhTXHQkIODp/ofbtNnSZB4pNh5RXdv4hIBM=
_COOKIE["www_pyrocms_development"] 2MH5lsDV3Cb3YK+6IcCrFaIH6Aeu98rIwKcgAaTcFnQsB5Vwn9ySGb3R3QfNTqvMoJsrfjDXv/PLdfYrVjr/IOREQhQIvsa1E+mozs5gYH6lC1+/mORDm2pN//InQBHTJGQsr3Y5jfzNYjakxXOArMRn2hmt14a18TON0VKMjpKjaBrl2aFx+CjypvIdF0oI4aXrK0HIWjhCl+VTdea4gFQzD6g7RblmKwHoJKCdYRCytWZ8z6y1HT3TQDMUOij3xqCXswrY0GD/bDfVvz16Ru07J8Y1z9v4Ye2hF8z7TiwomPIQgyiP+RSaOAebVRpF103KQvgjJjL5oSaywHiqX7noLEqQRsMjjaZFKMOgIpbtJoilytKby1TrdezhK4cFu/Kq1vTExhTXHQkIODp/ofbtNnSZB4pNh5RXdv4hIBM=
_SERVER["REDIRECT_PYRO_ENV"] production
_SERVER["HTTP_COOKIE"] www_pyrocms_development=2MH5lsDV3Cb3YK%2B6IcCrFaIH6Aeu98rIwKcgAaTcFnQsB5Vwn9ySGb3R3QfNTqvMoJsrfjDXv%2FPLdfYrVjr%2FIOREQhQIvsa1E%2Bmozs5gYH6lC1%2B%2FmORDm2pN%2F%2FInQBHTJGQsr3Y5jfzNYjakxXOArMRn2hmt14a18TON0VKMjpKjaBrl2aFx%2BCjypvIdF0oI4aXrK0HIWjhCl%2BVTdea4gFQzD6g7RblmKwHoJKCdYRCytWZ8z6y1HT3TQDMUOij3xqCXswrY0GD%2FbDfVvz16Ru07J8Y1z9v4Ye2hF8z7TiwomPIQgyiP%2BRSaOAebVRpF103KQvgjJjL5oSaywHiqX7noLEqQRsMjjaZFKMOgIpbtJoilytKby1TrdezhK4cFu%2FKq1vTExhTXHQkIODp%2FofbtNnSZB4pNh5RXdv4hIBM%3D; www_csrf_cookie_name=ced9bc01dc6439bdb4716964fe037173; www_identity=info%40xyz.com; www_remember_code=76aec0ab8b6b09091c1659bcf72d962b5337e226; web6_SID=89280348f350ecae51a672da350d8b7c; __utma=163786799.1178091424.1375554048.1375566051.1375568373.5; __utmb=163786799.3.10.1375568373; __utmc=163786799; __utmz=163786799.1375554048.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
虽然我在database.php中为生产和登台设置了不同的数据库,但PyroCMS没有采用正确的数据库连接。
此外,global:environment标记不起作用。当我在CMS中使用以下标记时,它不会在前端显示文本:{{if global:environment =='production'}} //仅限制作内容{{endif}}
< / LI>我还在Htaccess中尝试了另一种方法,其结果与上述相同:
SetEnvIf Host ^dev\.domain(.+)\.com$ PYRO_ENV=development
SetEnvIf Host ^test\.domain(.+)\.com$ PYRO_ENV=staging
SetEnvIf Host ^(www\.)?domain(.+)\.com$ PYRO_ENV=production
我认为上面的htaccess设置不会触发我的服务器的正确环境。有没有人有想法?
谢谢,
菲利普