活动主机上的codeigniter内部服务器错误 [英] Internal Server Error in codeigniter on live host

查看:131
本文介绍了活动主机上的codeigniter内部服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在public_html主文件夹(http://www.myexample.com)中部署了一个使用CodeIgniter的网站。该项目可在localhost上完美运行。为了从URL中删除index.php,它具有以下.htaccess:

I have deployed a website that uses CodeIgniter in the main public_html folder (http://www.myexample.com). This project working perfectly on localhost. In order to remove index.php from URL this has the following .htaccess:

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

但是,当我尝试访问网站时,我得到了一个内部服务器错误:

However, when I try to go to the website I'm getting an Internal Server Error:

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文件,但得到了相同的错误。

I have applied differently .htaccess files but getting the same error.

推荐答案

迁移到实时服务器时通常要做的事情如下:

first .htaccess

What I usually do when migrating to live server are as follows
first .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

then database username and password
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 或更高版本,并检查您框架的服务器要求。

if still you are getting error saying cannot connect, try verifying the database username, name and password and try changing the database password just to make sure its correct

UPDATE
Check the file permission and make sure it is 644 and folder permission to 755
Also check php, mysql versions and make sure php version is atlease 5.6 or higher and check server requirements of your framework.

这篇关于活动主机上的codeigniter内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆