On our office Mac, we have a local Apache server running through the software AMPPS. Prior to updating to Mojave, everything was working correctly. Now, after updating, there is an issue with using PHP
Our system uses an object for storing settings, and one of these is the document root path. This value is usually the same as
$_SERVER['DOCUMENT_ROOT'], however using that is not an option for various reasons.
An example of the issue that is occurring:
include settings::$documentRoot . '/fileToInclude.php';
This will resolve to the path
"/Applications/AMPPS/www/fileToInclude.php" and will fail with the standard 'not found' error:
Failed to open stream: No such file or directory
However, if I change the
include line to the following:
include $_SERVER['DOCUMENT_ROOT'] . '/fileToInclude.php';
which resolves to the path
"/Applications/AMPPS/www/fileToInclude.php" it will work without a problem.
As you can see, both
include statements resolve to the exact same path, but only one works. I have done testing to confirm that both paths match exactly using a strict equality check (
Does anyone have any idea why this would happen in Mojave? As I mentioned, it was working perfectly fine in High Sierra, and it works fine on all our Windows machines.
The server error logs output the following when trying to use the failing
PHP Warning: include(/Applications\xe2\x81\xa9/AMPPS\xe2\x81\xa9/www/fileToInclude.php): failed to open stream: No such file or directory in /Applications/AMPPS/www/index.php on line 14