I need the dynamical approach because my hosting uses ‘www’ as public folder instead of CakePHP’s ‘webroot’ folder.
But unfortunately, when I use the dynamical rule from above instead of the fixed approach, I can’t start my local server anymore. I always got this error:
[Thu Mar 23 23:05:40 2023] PHP Warning: Module ‘openssl’ already loaded in Unknown on line 0
Directory does not exist.
Warning: Module ‘openssl’ already loaded in Unknown on line 0
I have my XAMPP running Apache, but the project itself is running with the CakePHP 4 Server Tool.
As a test, I checked XAMPP’s php.ini file. I don’t see a duplicate openssl rule I must say…
Still, I wonder if this is really the problem as I didn’t have the error before I’ve changed the WWW_ROOT.
So, your WWW_ROOT constant will now have something like /home/sam/www? What is in that folder? Where are the src, config, vendor, etc. folders from your Cake project?
Your first (dev system) screenshot shows the webroot folder, at the same “level” as bin, config, logs, plugins, resources, src, templates, tests, tmp, vendor. Where are all those folders in your production environment?
I know this is bad behavior. Only the files in ‘webroot’ should be in the ‘www’ folder on the production environment. ‘config’, ‘src’, ‘templates’, ‘vendor’, … should be on the same level as the ‘www’ file.
But first, I try to have the dynamic WWW_ROOT so I can use the same setup in both environments
I believe that WWW_ROOT in this case should still be the webroot folder, but I’d really focus on getting the production site set up how it should be (i.e. all those other folders out of www), not on getting dev to match something that is going to need to change again anyway.
Hi @Zuluru! I don’t know how it works, but I could keep my original code in the development AND the production environment. So there was, surprisingly enough, no need to change the WWW_ROOT. Meanwhile, I’ve put all code outside the webroot folder