闲吧资源站
专注于虚拟主机、VPS介绍、评测及推荐!

godaddy主机空间用.htaccess升级PHP版本

godaddy主机使用起来其实没其他主机空间方便,如hostmonster主机。这不,前几天,闲吧帮别人管理的一个企业站就出现了问题。通过查明,闲吧发现是由于PHP版本的问题。立马去godaddy主机控制后台,发现GODADDY的主机现在不支持后台切换PHP版本了,后台默认是PHP5的版本。而这次出问题的原因是虽然GODADDY后台显示是PHP5的版本,但实际通过探针发现是PHP4的版本,这就导致那个企业站程序不支持,从而导致网站不能正常的显示。咨询了下狗大爹,他们的工作人员给了如下回复:

We reviewed your account and see that you are in fact using PHP 5. Your hosting account uses PHP files in the following way:
*PHP files — Your hosting account’s PHP version. For more information, see Viewing or Changing Your PHP Language Version.
*PHP4 files — PHP 4
*PHP5 files — PHP 5
However, you can also change how your hosting account uses PHP files with a .htaccess file located in your root directory.
The following entries in a directory’s .htaccess file designate PHP files to run under PHP 5 and PHP4 files to run under PHP 4.
AddHandler x-httpd-php5 .php
AddHandler x-httpd-php .php4

Grid Hosting accounts should use the following entries:
AddHandler x-httpd-php5-cgi .php
AddHandler x-httpd-php-cgi .php4

Changes made to an existing .htaccess file will be seen immediately. When creating new .htaccess files or deleting existing .htaccess files, you might not see changes for up to an hour.

很明显,godaddy的客服让我用.htaccess来改变PHP的版本。由于程序要求是PHP5,闲吧就在根目录下建了个.htaccess文件,输入了如下一行:

AddHandler x-httpd-php5-cgi .php

刷新PHP探针,发现PHP版本变成PHP5,再打开原来那个网站,一起正常,文件得到解决了。

转载请注明出处:闲吧资源站 » godaddy主机空间用.htaccess升级PHP版本

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址