Welcome Guest, Not a member yet? Register   Sign In
Install CodeIgniter 4 on Shared Hosting
#1

(This post was last modified: 03-28-2020, 03:56 PM by jreklund.)

Hi, I'm having some difficulty installing a copy of codeigniter 4 via archive.

I find the pattern

- app
- public
- system

And I don't know how to get it displayed, I put the base of my web address in the configuration file but nothing. How do I proceed? What are the steps for an installation by uploading from archive? Thanks
Reply
#2

It depends on what type of server you are using.

Document Root should point to the public folder, for CodeIgniter to be able to work.
Reply
#3

Hi, this is a normal shared hosting.
How can I make everything point to the index.php contained in the public folder?
Reply
#4

Hi, I'm afraid we don't have that in the documentation as of yet. But you are in luck, I wrote it today. :-)

Shared Hosting with cPanel

cPanel is a Linux-based web hosting control panel that provides a powerful set of automation tools in an easy and
straightforward interface, allowing a simplified process for hosting websites.

The contents of CodeIgniter's public folder should be placed in your domain's Document Root, in cPanel's case it's
called public_html for your Main Domain. Here is an example of a directory structure that are created by cPanel:


Code:
/bin
/cache
/cpanelbranding
/etc
/logs
/mail
/perl
/php
/public_ftp
/public_html
/ssl
/tmp
/var


All other Default Directories should be placed in your Home Directory /home/username/ referred to as / above. But this will just turn into a mess as it's difficult to see what folder/files belong to cPanel and/or CodeIgniter.

Therefor it's recommended to create another folder named after your domain name in your home directory,
and place all other folders and files (refer to ... below) in it. This makes the final structure look like this:


Code:
/example.com
        /app
        /system
        /writable
        /tests
        ...
/public_html
        robots.txt
        index.php
        favicon.ico
        .htaccess


Since we changed the directory structure we have to tell CodeIgniter about it. Open /public_html/index.php
in a text editor and change the following line to match your domain name directory that we previously created.

PHP Code:
$pathsPath FCPATH '../example.com/app/Config/Paths.php'
Reply
#5

(This post was last modified: 03-30-2020, 08:03 AM by Marcolino92.)

Thanks for your answer, this error is shown:

Warning: require(../vendor/codeigniter4/framework/system/bootstrap.php): failed to open stream: No such file or directory in /home/mhd-01/www.-----------.com/htdocs/test/index.php on line 36

Fatal error: require(): Failed opening required '../vendor/codeigniter4/framework/system/bootstrap.php' (include_path='.:/usr/share/php') in /home/mhd-01/www.------.com/htdocs/test/index.php on line 36

Also, leaving the .htaccess file releases a 505 error
Reply
#6

/home/mhd-01/www.-----------.com/htdocs/test/index.php

htdocs are in this case your public_html folder. But what are the test folder?

Where did you place all folders? Can you draw a map/print screen the folder?
Reply
#7

(03-30-2020, 08:49 AM)jreklund Wrote: /home/mhd-01/www.-----------.com/htdocs/test/index.php

htdocs are in this case your public_html folder. But what are the test folder?

Where did you place all folders? Can you draw a map/print screen the folder?

if i havent cpanel (free hosting) the procedure is the same ?
Reply
#8

I just don't get this, my server shared hosting with linux, cpanel and public_html

All I have to do is rename public to public_html upload all my files to the root using Filezilla FTP

And all done can log right on to my site.
What did you Try? What did you Get? What did you Expect?

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

(08-19-2020, 09:45 AM)InsiteFX Wrote: I just don't get this, my server shared hosting with linux, cpanel and public_html

All I have to do is rename public to public_html upload all my files to the root using Filezilla FTP

And all done can log right on to my site.


i try to install on altervista (free hosting without cpanel , without public_html [\ is the public_html]) , i want install ci4 on subfolder(in several of my project ci work in a subfolder where in the root are wp or joomla) . i copy all file in the subfolder :


http://ci4.altervista.org/codeigniter4auth/public/

t
his is the error :

ErrorException

realpath(): open_basedir restriction in effect. File(/var/www/html) is not within the allowed path(s): (/membri/ci4/:/membri2/ci4/:/membri/.dummy/) 




Reply
#10

The solution are not to cheap out, get a real hosting provider. You can get one for as low as $20/year.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB