Welcome Guest, Not a member yet? Register   Sign In
How to run codeigniter4 in shared hosting ?
#10

That's correct. If you upload everything as is (renaming /public into /public_html), you will end up with the following structure in Cpanel, based upon /.
/public_html are always your main domains document root, and that can't be changed. Only subdomain and addon domains have that ability (through Cpanel itself).


Code:
|  .gitignore
|  composer.json
|  contributing.md
|  env
|  LICENSE
|  license.txt
|  phpunit.xml.dist
|  README.md
|  spark

+---app             
+---public_html
|      .htaccess
|      favicon.ico
|      index.php
|      robots.txt
|     
+---system
+---tests
+---writable


And that can also cause som clutter, if you want to have another website later on (subdomains / addon domains) with different Document root.
And here you can actually create /subdomain.domain.com/public as the document root. And upload the CI folder into /subdomain.domain.com and it will work out of the box.

My recommendation are always placing codeigniter4 files inside another folder, so that you don't clutter /, the folder name codeigniter4 can be whatever you want. May be the domain name.


Code:
+---codeigniter4
|  |  .gitignore
|  |  composer.json
|  |  contributing.md
|  |  env
|  |  LICENSE
|  |  license.txt
|  |  phpunit.xml.dist
|  |  README.md
|  |  spark
|  | 
|  +---app
|  +---system
|  +---tests           
|  +---writable
|             
\---public_html
        .htaccess
        favicon.ico
        index.php
        robots.txt


But for this trick to work, you need to open your /public_html/index.php and change into the following:
PHP Code:
$pathsPath FCPATH '../codeigniter4/app/Config/Paths.php'
Reply


Messages In This Thread
RE: How to run codeigniter4 in shared hosting ? - by bitshifter - 03-24-2020, 03:55 PM
RE: How to run codeigniter4 in shared hosting ? - by jreklund - 03-25-2020, 01:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB