Welcome Guest, Not a member yet? Register   Sign In
Relocating the app folder

(This post was last modified: 06-16-2022, 07:24 AM by groovebird.)


if i relocate the app folder the ROOTPATH will not be created correctly, because it is one folder above the app folder. This is not working if i relocate the app folder:

Root -> app -> this is working

Relocating the app folder:
Root -> codeigniter->app -> this is not working, because the ROOTPATH is codeigniter. This is not correct.

PHP Code:
// The path to the project root directory. Just above APPPATH.
if (! defined('ROOTPATH')) {
    define('ROOTPATH'realpath(APPPATH '../') . DIRECTORY_SEPARATOR);

I think relocating is not possible or is there any solution?

You'll need to update the app/Config/Paths.php file with the correct settings. IIRC, that's all you should need to do to make it all work.

Quote:because the ROOTPATH is codeigniter. This is not correct.

What is the "codeigniter" directory for?

I'm not sure ROOTPATH really means.
But I'm sure .env file must be at ROOTPATH.

(This post was last modified: 06-17-2022, 02:40 AM by groovebird.)

(06-16-2022, 11:00 PM)kenjis Wrote: Why?
What is the "codeigniter" directory for?

This directory is from an older installation. I had an application folder in it and now i want to keep the folder structure. Yes i could change it, but this is not the topic :-)

Lets say my project root is a folder named my_project_root.
Why is the ROOTPATH not correct? My app folder is in my_project_root/codeigniter/app and if i echo out the ROOTPATH variable i get my_project_root/codeigniter because of this code:

PHP Code:

The root is one level above from the APPPATH. In my case the root is 2 levels above the APPPATH

The ROOTPATH should be my_project_root. In this folder i have my .env file and not in my_project_root/codeigniter. The ROOTPATH depends on the APPPATH and i suggest this is the reason i cant relocate the folder

Okay, you have only one app in the my_project_root, and ROOTPATH should be my_project_root.

How about adding the following code in app/Config/Paths.php ?

PHP Code:
define('ROOTPATH'__DIR__ '/../../../' DIRECTORY_SEPARATOR); 

@kenjis yes this is working. I didn't know that i can redefine the ROOTPATH, because it is defined in the bootrap.php. But then this is the solution. Should it be in the documentation? I didn't understand this comment from the Paths.php

"The folder can also be renamed or relocated anywhere on your getServer. If you do, use a full getServer path."

This is only possible by redefining the ROOTPATH? What does getServer mean?

Oh! "getServer" seems to be mistake of "find and replace". It means just "Server".


Theme © iAndrew 2016 - Forum software by © MyBB