如果没有 .htaccess 可用性,CodeIgniter 无法在 PHP 4 服务器上运行

发布于 2024-09-01 01:57:54 字数 298 浏览 5 评论 0原文

基本上我在本地主机 wamp 服务器上使用 PHP 5 开发了我的应用程序。在上传到实际主机时,我注意到

  1. 服务器正在运行 php 4.4.9
  2. 每次我上传 .htaccess 文件时,服务器都会将其完全删除..似乎不是允许
  3. 当我测试该设置时,我得到的只是一个未找到的 404 页面

有关如何使其在此 PHP 4 服务器上工作的任何帮助吗?


我用 CI 1.7.2 做了测试,默认安装..在我的本地服务器上可以工作,但是上传时不起作用,这是否意味着服务器不支持它?

Basically i developed my app on a localhost wamp server with PHP 5. ON uploading to the actual host i notice that

  1. The server is running php 4.4.9
  2. Everytime i upload my .htaccess file, the server removes it completely.. seems to not be allowed
  3. When i test out the set all i get is a 404 page not found

Any help on how to make it work on this PHP 4 server?


I did a test with CI 1.7.2, default installation.. works on my local server but when uploaded does not work, does this mean that the server does not support it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

醉南桥 2024-09-08 01:57:54

我确信这不是您想要的,但是获取一个新服务器。原因如下:

  1. PHP 4 不再得到良好支持。这是没有安全感的。
  2. 如果服务器正在删除 .htaccess 文件,则该服务器也不支持它们,这给您提供了多一个移动的理由。
  3. Code Igniter 在 PHP 5 和 .htaccess 文件中运行效果最佳。

其要点是,您将不得不将代码修改回黑暗时代才能使其正常工作,然后您仍然会遇到相当大的 URL 问题和整体系统不稳定。如果你能做出改变,那就去做吧。

I'm sure this isn't what you want to here, but get a new server. Here are the reasons why:

  1. PHP 4 is no longer well supported. It's insecure.
  2. If the server is removing .htaccess files, they are also unsupported on that server, giving you one more reason to move.
  3. Code Igniter runs best with PHP 5 and with an .htaccess file.

The gist of this is you are going to have to hack your code back into the dark ages to get this to work, and then you will still have pretty URL issues and overall system instability. If you can make the switch, do.

尝蛊 2024-09-08 01:57:54

如果您无法将 .htaccess 文件与 CodeIgniter 一起使用,则在 system/application/config/config.php 中有一个名为 index_page 的配置键。您需要将其设置为引导 CodeIgniter 的任何页面(通常是 /index.php

然后,确保通过 CI 路由的所有链接都指向 index.php/controller/action /params... 或利用 URL 帮助程序(使用 site_urlanchor)自动放入 index.php

Joe Mills 的回答完全正确, 尽管。 CI 最适合与 PHP 5 和 .htaccess 配合使用。

请参阅 CI URLCI URL Helper 用于文档。

If you cannot use .htaccess files with CodeIgniter, in system/application/config/config.php there is a configuration key called index_page. You need to set that to whatever page you have bootstrapping CodeIgniter (usually /index.php)

Then, make sure all your links that get routed through CI either target index.php/controller/action/params... or utilize the URL helper (with site_url or anchor) to automatically put in the index.php

Joe Mills is exactly right in his answer, though. CI works best with PHP 5 and .htaccess.

See CI URLs and CI URL Helper for documentation.

笨笨の傻瓜 2024-09-08 01:57:54

好吧,我发现了如何解决一些问题

  1. 。 .htaccess 的问题是不使用 modrewrite,因为我将“query_string”选项放在我的路径变量中,这样就可以了。
  2. 另一个问题是主要问题是我使用的是 Datamapper 库,它是一个仅 php 5 的库。

Well i found out how to fix several things

  1. The issue with .htaccess would be to just not use modrewrite as such i put "query_string" option in my path variavable and this works.
  2. The other issue, which was the major issue was that i was using Datamapper library which is a php 5 only library.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文