PHPstorm and absolute root (for use with php-fpm)
The the project, I have an example like this:
include_once "/include/myfile.inc" ;
This generates a warning, despite the resource root being set to the topmost folder of the project, and in my understanding, this should be the equivalent of / as seen from the project. This, as the mapping for upload can later translate where the code goes.
I am running php-fpm in jailed mode, so the server root is actually /, not a relative path, nor anything above.
How do i convince my phpstorm to treat the "sources root" as /, from a code inspection perspective?
请先登录再写评论。
> How do i convince my phpstorm to treat the "sources root" as /, from a code inspection perspective?
There's no such a way.
Please consider using $_SERVER['DOCUMENT_ROOT'] instead.
Problem with this $_SERVER['DOCUMENT_ROOT'] is that it doesn't reflect a location on the dev PC, and will not work for me on the server, as some code runs from a chroot, while other items runs from outside the jail, and as such, has to consider 2 actual real locations at any given time, depending on which context it is used in, and where from the development point of view, everything is cosidered / in the local dev location (resources root), from the phpstorms code inspect perspective.
If it is not possible, ok, it's just so pesky not getting a clear green label on the code, just because it will not allow you to set a reference point, where resource root is / or any other relative path, from the codes perspective.
Having said that, i don't see how complex it would be to say that "resources root" is one of defined paths, and matching the file paths against them, then if you have a match, accept that as the answer for the location of the referenced file.
thus, if resources root is marked as /, and you have a path being /includes/..... and the path matches from the definition of resources root as /, you have a match, and the actual file is considered found.