Andre Clements
Andre Clements

Reputation: 874

Installing upgraded CodeIgniter-4 on shared host directory

Having rebuilt an app originally built in Codeigniter-3 in CI4, which runs fine locally on XAMPP with PHP 8.1, how does one upload install it on a shared host?

I see there is no index.php in the root folder, just a preload.php... I found I could get a response by browsing routes in the public directory, e.g. https://ijump-trampoline.co.za/clearwater2/public/booking - but am pretty sure that is not the way to do things. And I don't know if the CodeIgniter\Exceptions\FrameworkException Core.enabledZlibOutputCompression that I got then has to do with using an improper URL, or I'm about to discover CI4 requires some library the shared host, Xneelo, doesn't support.

I have also tried placing an index.php file with include 'public/index.php'; in the root directory but have removed that again.

Currently, I'm getting a HTTP 500 error even when trying to access the url listed above and have no idea why - and at a loss for how to proceed.

The old Codeigniter-3 version of the system is still running at https://ijump-trampoline.co.za/clearwater/booking and the plan was to replace that with the new CI4 version and keep the existing URL structure. (There are to be other branches with their own installations in neighboring directories in the same TLD.)

Upvotes: 0

Views: 496

Answers (1)

Maitalata
Maitalata

Reputation: 19

Codeigniter 4 has many differences with Codeigniter 3. The best way to put your Codeigniter 4 in shared hosting is to take everything inside the Codeigniter 4 public folder and put it in your public_html folder on cpanel, then put the put your other app, system and other folder and files in another folder outside the public_html (I usually create a new folder naming it after my project). Then in the index.php in your public_html folder

require FCPATH . '../app/Config/Paths.php';

to reflect your new folder and app such as

require FCPATH . '../myapp/app/Config/Paths.php';

Assuming you named your folder myapp and put your project files there.

Upvotes: 2

Related Questions