duanliao5995 2014-09-25 20:07
浏览 58

htaccess在共享服务器上导致错误的php版本

I am hosting several websites on Godaddy. (probably my first mistake)

My main website has a .htaccess file which blocks all TOR exit nodes, because it's been subject to alot of abuse from TOR users.

The second site is in its own folder and has its own domain. It has its own .htaccess file. It NEEDS this, because it is codeigniter based, and needs the data in the file for the URLs to work the way I need them to.

That said, if I use phpinfo() on the main domain, it shows php5.4, but when I use it on the codeigniter based site, which is one level down, it shows php5.2.17. I need the codeigniter site to use 5.3+, because I need to be able to do some work with DateTime methods which aren't otherwise available.

Anyway, after 3 phone calls and 2 hours of hold time, Godaddy tech support disabled the .htaccess files for both folders, and voila, codeigniter site was finally showing php5.4

I have tried having one enabled, the other disabled, and vise-versa, but the inner folder only has the correct php with both disabled. This is problematic, because I need both to be working. I will post both .htaccess files, hoping someone here can help me sort this out.

main domain htaccess (several lines omitted because repeated IP address listings):

    DirectoryIndex index.html
AddCharset UTF-8 .html
AddCharset UTF-8 .php

FileETag None

<IfModule mod_headers.c>
<Files *.html>
Header add Expires "Mon, 26 Jul 1997 05:00:00 GMT"
Header add Pragma "no-cache"
Header add Cache-Control "max-age=0; must-revalidate; no-cache"
Header set Expires "0"
Header unset Vary
</Files>
</IfModule>
<Files spam.txt>
order allow,deny
deny from all
</Files>

order allow,deny
deny from 173.245.52.227
deny from 37.52
deny from 37.53

# This is a list of all Tor exit nodes from the past 16 hours that can contact 50.63.99.1 on port 80 #
# You can update this list by visiting https://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=50.63.99.1 #
# This segment was generated on Fri Jan 10 15:04:19 UTC 2014 #
deny from 1.0.207.200
deny from 98.219.67.36
deny from 98.22.221.97
deny from 99.153.177.174
deny from 99.245.160.4
deny from 99.60.156.91

allow from all

# Warning: Contents below this line may be erased, please place all .htaccess rules above this line
## !KU_BANS:

inner folder (btcbidder.com, codeigniter based):

Options +ExecCGI
AddHandler x-httpd-php5-cgi .php

DirectoryIndex index.php index.html
AddCharset UTF-8 .html
AddCharset UTF-8 .php

FileETag None

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?$1 [L]
</IfModule>
  • 写回答

1条回答 默认 最新

  • doumi0737 2014-09-25 20:23
    关注

    As suggested by @jedwards, the problem was in the AddHandler x-httpd-php5-cgi .php directive.

    I changed it to AddHandler x-httpd-php5-4 .php, which now lets me access the DateTime class methods which is why I went on this excursion in the first place.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题