Welcome Guest, Not a member yet? Register   Sign In
Codeigniter-4 not working on VPS Server
#1

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
Reply
#2

We need more information.

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

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(This post was last modified: 04-14-2021, 01:03 PM by laynebay.)

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.
Reply
#4

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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB