Sometimes it becomes necessary to be able to test production using development variables. No need to delve into the reasoning, but if you're looking for the solution to this issue because you were used to the Pimcore 6 debug mode toggle and IP address field, this is what you're looking for.
Setting Apache Env Vars
To begin, locate the /public
directory in your project, and add the following lines to the top of the .htaccess
document:
SetEnvIf Remote_Addr 1\.2\.3\.4 APP_ENV=dev SetEnvIf Remote_Addr 1\.2\.3\.4 APP_DEBUG=1
Remember to replace the 1\.2\.3\.4
with your actual public IP address. Go ahead and commit these changes to the file.
Setting .env Vars
Now, we will need to copy the .env file and add the .dev extension to it. This can be done with the following commands from your CLI of choice:
cp .env .env.dev
The dot env library will switch between these documents while initializing Symfony and Pimcore X. To complete the configuration we need to change what variables are being set in each of these files.
The .env File
###> symfony/framework-bundle ### #APP_ENV=dev APP_ENV=prod
The .env.dev File
###> symfony/framework-bundle ### APP_ENV=dev #APP_ENV=prod
The important thing to note about these files is that .env document is responsibles for setting the APP_ENV variable to prod, and by contrast the .env.dev file is responsible for setting the APP_ENV variable to dev.
Topics
## PAGE REGION UNDER MAINTENANCE ##
Related Articles
## PAGE REGION UNDER MAINTENANCE ##