CodeIgniter PHP Apache 500 Internal Server Error

前端 未结 5 1599
梦毁少年i
梦毁少年i 2020-12-08 21:39

I did a project in CodeIgniter. It\'s working fine on my localhost, but giving \"500 Internal Server Error\" on the remote server. This is my .htaccess file con

5条回答
  •  执笔经年
    2020-12-08 22:28

    Posting this, just in case it helps somebody...

    Other answers to this question assume that you have access to apache's configuration files. But if you are on a shared hosting platform and do not have access to directories other than the ones where you are supposed to host your files: the trick was to force php to throw all errors even if apache could not.

    Open "index.php" that resides in the root folder of your codeigniter installation;

    /*switch to development environment*/
    define('ENVIRONMENT', 'development');
    
    if (defined('ENVIRONMENT'))
    {
        switch (ENVIRONMENT)
            {
                case 'development':
                error_reporting(E_ALL);
                /*added line below*/
                ini_set('display_errors', '1');
                break;
    ......
    

    Making the above change immediately started displaying what was wrong with the code and I was able to fix it and get it up and running.

    Don't forget to set your codeigniter environment to "production" once you're done fixing it.

提交回复
热议问题