Getting Started with CodeIgniter 4 PreAlpha 1 |
(02-20-2017, 02:10 PM)baselbj Wrote:(06-26-2016, 08:24 PM)kilishan Wrote: One thing I forgot to mention in that post, but that is worth knowing is that the default environment is now "production" to save any accidents when pushing to a live site. To change the environment to development, the best thing is to edit the .htaccess file (if using Apache) that came with the download. Toward the top is a line like: Code: fastcgi_param CI_ENV development; (02-21-2017, 02:10 AM)Narf Wrote:(02-20-2017, 02:10 PM)baselbj Wrote:(06-26-2016, 08:24 PM)kilishan Wrote: One thing I forgot to mention in that post, but that is worth knowing is that the default environment is now "production" to save any accidents when pushing to a live site. To change the environment to development, the best thing is to edit the .htaccess file (if using Apache) that came with the download. Toward the top is a line like: Thank You
I've played with CI4 and I don't know where is the proper place to mention mistakes in the documentation and errors in CI itself. A few problems that I've found:
- The correct place of .env files is not the /application directory, but the root directory (where the composer.json lives). - $_ENV global variable and getenv function works normally, but if I try to use them in the Database config I get the following error: Fatal error: Constant expression contains invalid operations in /media/sf_code/ci4.dev/gitroot/ci4/application/Config/Database.php
I have used CI for quite some time and created all localhost files to be a mirror image of the onsite files. This was done by creating the following constant:
PHP Code: defined('LOCALHOST') || define('LOCALHOST', 'localhost'===$_SERVER['SERVER_NAME']); Differences such as paths, adverts, display Analytics, etc could then be switched out locally using the following: PHP Code: if( ! LOCALHOST): I tried using this method with the CI4 installation and the class namespace created problems I eventually managed to find a solution by using the following: .htaccess Code: # Sets the environment that CodeIgniter index.php PHP Code: # SetVar Constants MUST BE SET IN .htaccess These two files require modifing: ./Config/App.php PHP Code: # public $systemDirectory = '../system'; ./Config/Paths.php PHP Code: public $publicDirectory = CI_PUBDIR ; // 'public'; // public'; Using this technique gives peace of mind knowing that any file modified locally will not create problems when uploaded. I have just used the above method and the installation worked first time! I was wondering if this could be applied to the current CI4 installation? |
Welcome Guest, Not a member yet? Register Sign In |