CodeIgniter Forums
Codeigniter-4 not working on VPS Server - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Codeigniter-4 not working on VPS Server (/showthread.php?tid=79051)



Codeigniter-4 not working on VPS Server - Ismail Agha - 04-13-2021

Hello Team,

The CI code/website is working fine for me on the localhost. But it's failing when migrated to the live server. 

The code is failing after reaching to below lines of code in the file ' system/bootstrap.php ':
$appConfig = config(\Config\App::class);
$app      = new \CodeIgniter\CodeIgniter($appConfig);
$app->initialize();


The call to bootstrap.php is made in the index.php page :
$app = require rtrim($paths->systemDirectory, '/ ') . '/bootstrap.php';

Could someone please help me to solve this issue?

Thanks & Regards


RE: Codeigniter-4 not working on VPS Server - InsiteFX - 04-14-2021

We need more information.

1) What is your folder structure?
2) Did you set your base_url correct with an ending slash / ?
3) etc;


RE: Codeigniter-4 not working on VPS Server - laynebay - 04-14-2021

I have the exact same problem. I've been decent at troubleshooting OS/server/hosting/version thing for years. I cannot get to the bottom of this.

I have standard structure for CI4 and this app is working locally and on 2 different cloud dev servers. Not working on client's Azure/CentOS environment running PHP 7.3.11. CI 4.0.4.

I try to trace placing die() and run into same as Ismail. I cannot get anything returned other than a generic 500 error. Even with development on, etc. tried placing PHP errors around, no joy. Usually this is a permissions thing but I should have cracked that by now. Will likely be something super small or random but I've reached the point of asking for help here.

Thanks!

My Solve:
I kept digging.  Hope this helps someone. Makes sense if it's a different environment and PHP wasn't installed a certain way or all the way.

Error was this:
Code:
Fatal error: Uncaught Error: Call to undefined function CodeIgniter\locale_set_default() in /var/www/webapp/vendor/codeigniter4/framework/system/CodeIgniter.php:184

You can figure out your particular flavor of OS and version of PHP and install php{version}-intl or in an emergency, comment out the line (I'm not suggesting that but it works or testing).

If it is installed already, you may only need to do this:
- Open the php.ini file:
- Uncomment the following line (extension=intl)
- Restart webserver

It was not installed on the client's CentOS server and it's production, so I didn't risk upgrading all of PHP to get this working.

Good luck.


RE: Codeigniter-4 not working on VPS Server - craig - 04-15-2021

The documentation does mention that intl is a requirement, so it's always worth checking that those are met:

Quote:PHP version 7.3 or newer is required, with the *intl* extension and *mbstring* extension installed.