php – 活动主机上的codeigniter中的内部服务器错误

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了php – 活动主机上的codeigniter中的内部服务器错误脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经在主public_htML文件夹(http://www.myexample.COM)中部署了一个使用CodeignITer的网站.这个项目完全适用于localhost.为了从URL中删除index.PHP,它具有以下.htaccess:

RewriteEngine on
RewriteCond $1 !^(index\.PHP|public|\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
rewriterule ^(.*)$index.PHP?$1

但是,当我尝试访问该网站时,我收到内部服务器错误

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@its.org.pk to inform them of the time this error occurred,and the actions you PErformed just before this error.

More information about this error may be available in the server error LOG.

Additionally,a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

我已经应用了不同的.htaccess文件,但得到了同样的错误.

解决方法

迁移到实时服务器时我通常做的事情如下
首先.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.PHP controller,#prevIoUsly this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$/index.PHP?/$1 [L]

#When your application folder isn't in the system folder
#This snippet PRevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$/index.PHP?/$1 [L]

#Checks to see if the user is attempting to access a valid file,#such as an image or css document,if this isn't true it sends the
#request to index.PHP
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$index.PHP?/$1 [L]
</IfModule>

然后数据库用户名和密码

application / config / database.PHP

$db['default'] = array(
'dsn'   => '','hostname' => 'localhost','username' => 'DATABASE_USERNAME',//database username here
'password' => 'DATABASE_PASSWORD',//database password here
'database' => 'DATABASE_NAME',//database name here
'dbdriver' => 'MysqLi','dbprefix' => '','pconnect' => FALSE,'db_debug' => (envIRONMENT !== 'production'),'cache_on' => FALSE,'cachedir' => '','char_set' => 'utf8','dbcollat' => 'utf8_general_ci','swap_pre' => '','encrypt' => FALSE,'comPress' => FALSE,'stricton' => FALSE,'failover' => array(),'save_queries' => TRUE
);

然后在配置文件
application / config / config.PHP

$config['base_url'] = 'http://example.com/';

如果你仍然收到错误说无法连接,请尝试验证数据库用户名,名称和密码,并尝试更改数据库密码,以确保其正确

UPDATE

检查文件权限,确保它是644,文件夹权限为755

还要检查PHP,MysqL版本并确保PHP版本为5.6或更高版本并检查框架的服务器要求.

脚本宝典总结

以上是脚本宝典为你收集整理的php – 活动主机上的codeigniter中的内部服务器错误全部内容,希望文章能够帮你解决php – 活动主机上的codeigniter中的内部服务器错误所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。