Codeigniter – dynamically getting relative/absolute path outside of application folder

In the index.php file in the root, most useful paths are defined so that you can use them within the rest of the code. Have you tried FCPATH in this case?

FCPATH   -> "https://stackoverflow.com/"
BASEPATH -> '/system/'
APPPATH  -> '/application/'

UPDATE: As mentioned in the comments, the path examples above are only to give an overview. To increase the security of your project, BASEPATH and APPPATH wouldn’t be inside FCPATH and instead outside of the public www/root directory.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)