0

I have 100% working Codeigniter project on localhost.

I have installed LAMP on my Ubuntu 14 server following this guideline

I debugged code very carefully and found that it does not goes further than this line in /var/www/html/bonfire/codeigniter/core/CodeIgniter.php

if (!file_exists(APPPATH . 'controllers/' . $RTR->fetch_directory() . $RTR->fetch_class() . '.php')) {
           // some code here

} else {

    echo "<pre>";
    var_dump(__FILE__);
    var_dump(APPPATH . 'controllers/' . $RTR->fetch_directory() . $RTR->fetch_class() . '.php');
    echo "</pre>";
    // CODE DOES NOT GOES FURTHER THAN THIS LINE
    include(APPPATH . 'controllers/' . $RTR->fetch_directory() . $RTR->fetch_class() . '.php');
}

Output on my browser is

string(54) "/var/www/html/bonfire/codeigniter/core/CodeIgniter.php"
string(35) ".//application/controllers/home.php"

I also tried to put debug messages in application/controllers/home.php's constructor but that is not even shown in browser.

I have this in my index.php

    error_reporting(E_ALL);

    // Display errors in output
    ini_set('display_errors', 1);

I also have display_errors = On in my php.ini

Any idea what could be wrong? I have spent 4 hours on this :(

More information requested my commentators:

1) My phpinfo: https://pastebin.com/CmFZq2yJ

2) php -m | grep mysql returns empty ... cat /var/log/apache2/error.log shows this https://pastebin.com/q0yyP3Hx ... and here are Codeigniter's logs from localhost and live server respectively ... https://pastebin.com/jWNL2u9M and https://pastebin.com/Z2Xz5xFn

Umair Ayub
  • 19,358
  • 14
  • 72
  • 146
  • 1
    Try to change yopur controller name from `home.php` to Home.php – Ketan Solanki Sep 09 '17 at 10:25
  • @KetanSolanki I did but now I get Codeigniter Bonfire's default error page `404 Page Not Found The page you requested was not found.` – Umair Ayub Sep 09 '17 at 10:29
  • 1
    Once you move a project from your localhost to Unix OS, problems come 80% of the times either from **Directory write permission** or **Lower-case/Upper-case filenames mismatch** – aspirinemaga Sep 09 '17 at 10:30
  • @KetanSolanki I have this same project working well on another CentOS server – Umair Ayub Sep 09 '17 at 10:30
  • Can we disable `Lower-case/Upper-case filenames mismatch` thing? or maybe debug that thing? my greatest worry is I dont see any warning/error etc – Umair Ayub Sep 09 '17 at 10:30
  • @Umair - check your log file and show us what is in there. It's usually in your project directory. – aspirinemaga Sep 09 '17 at 10:31
  • @aspirinemaga file at `/var/log/apache2/error.log` is empty – Umair Ayub Sep 09 '17 at 10:34
  • @Umair - try to turn on your Debugging. Enable a log threshold to 4. Line 226 in `application/config/config.php` and refresh the page, then check out your log file in `application/logs/` – aspirinemaga Sep 09 '17 at 10:40
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/154019/discussion-between-umair-and-aspirinemaga). – Umair Ayub Sep 09 '17 at 10:41

2 Answers2

1

Please check if your have properly installed LAMP;

There is a high chance that somethings missing on LAMP;

Please check if you have mysql server installed;

execute

php -m | grep mysql

it should display something;

another you might want to debug using the log;

cat /var/log/apache2/error.log

Hope this helps u a bit

ckkaqa
  • 171
  • 1
  • 8
  • `php -m | grep mysql` returns empty ... `cat /var/log/apache2/error.log` shows this https://pastebin.com/q0yyP3Hx ... and here are Codeigniter's logs from localhost and live server respectively ... https://pastebin.com/jWNL2u9M and https://pastebin.com/Z2Xz5xFn – Umair Ayub Sep 11 '17 at 06:26
  • Your application is showing blank because you havent installed mysql server then; try installing again mysql server then always check if php -m | grep mysql return "mysql" – ckkaqa Sep 12 '17 at 06:43
0

If you could get the page to display errors or else show the error in error log it could help. But with Code Igniter that problem is likely to be due to the new (remote) server enforcing 'Strict standards' whereas your localhost does not. You might be able to solve it by editing core/Common.php file around line number 257 from return $_config[0] =& $config; to $_config[0] =& $config; return $_config[0];

  • I have enabled error reporting but still i dont see any error on browser – Umair Ayub Sep 10 '17 at 03:26
  • For displaying the errors, try more error reporting enabling with these three statements at the beginning of the php file: ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); and check on the accepted answer and comments at https://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display – John B. Walugembe Sep 10 '17 at 04:56
  • Dude I have tried everything ... but looks like it has some issues with Directory write permission or Lower-case/Upper-case filenames mismatch – Umair Ayub Sep 10 '17 at 05:13
  • Sorry, you had not indicated that you had included the startup error display `ini_set('display_startup_errors', 1);`. I once had a very similar problem which was finally resolved by fixing the 'strict standards' as indicated in my answer above. – John B. Walugembe Sep 10 '17 at 06:54
  • I now added `ini_set('display_startup_errors', 1);` and I also saw that suggestion from your answer, its already like that ... still no luck – Umair Ayub Sep 10 '17 at 06:56
  • I would like to know which PHP versions you have on your localhost, the new Ubuntu 14 server and the other CentosOS server, plus the location of the php.ini file that you edited compared to the one given by `phpinfo();` run from the folder where the index.php is located. – John B. Walugembe Sep 11 '17 at 06:06
  • Here is my localhost's PHPinfo() https://pastebin.com/P6hsW6gA .... and here is my server's PHPinfo() ... https://pastebin.com/9NPB1jsz – Umair Ayub Sep 11 '17 at 06:33
  • An observation on the phpinfo() pasted, the one on localhost has `display_startup_errors On On` while the one on the server has `display_startup_errors Off Off`. – John B. Walugembe Sep 11 '17 at 21:05