note 125170 added to language.constants.predefined

From: Date: Mon, 06 Jul 2020 15:40:33 +0000
Subject: note 125170 added to language.constants.predefined
Groups: php.notes 
Request: Send a blank email to php-notes+get-214837@lists.php.net to get a copy of this message
If you're using PHP with fpm (common in this day and age), be aware that __DIR__ and __FILE__ will return values based on the fpm root which MAY differ from its actual location on the file system. This can cause temporary head-scratching if deploying an app where php files within the web root pull in PHP files from outside of itself (a very common case). You may be wondering why __DIR__ returns "/" when the file itself lives in /var/www/html or whathaveyou. You might handle such a situation by having NGINX explicitly add the necessary part of the path in its fastcgi request and then you can set the root on the FPM process / server / container to be something other than the webroot (so long as no other way it could become publicly accessible). Hope that saves someone five minutes who's moving code to FPM that uses __DIR__. ---- Server IP: 45.112.84.4 Probable Submitter: 103.51.166.36 (proxied: 92.27.142.131) ---- Manual Page -- http://php.net/manual/en/language.constants.predefined.php Edit -- https://master.php.net/note/edit/125170 Del: integrated -- https://master.php.net/note/delete/125170/integrated Del: useless -- https://master.php.net/note/delete/125170/useless Del: bad code -- https://master.php.net/note/delete/125170/bad+code Del: spam -- https://master.php.net/note/delete/125170/spam Del: non-english -- https://master.php.net/note/delete/125170/non-english Del: in docs -- https://master.php.net/note/delete/125170/in+docs Del: other reasons-- https://master.php.net/note/delete/125170 Reject -- https://master.php.net/note/reject/125170 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#214837) next »