'PHP 8.1.2 realpath returning false
I am currently upgrading my PHP website from 7.4 to 8.1.2 but I'm having an issue with 'realpath'. No matter what directory I put in the variable '$install_folder' just shows as false. It's bizarre as I tested this on my PHP 7.4 website and the code works as it should.
$install_folder = realpath(__DIR__ . '/../../../');
I have tried to cheese the fix by:
$dir = __DIR__;
$install_folder = realpath($dir . '/../../../');
Any suggestions would be highly appreciated!
Solution 1:[1]
Is the php cli interpreter installed on your system? On Debian/Ubuntu based systems this is the phpX-cli package.
IF the cli package is installed, I'd want to see the output of a test script that might shed some light on things.
#/path/to/php8
$dir = __DIR__;
echo $dir;
$install_folder = realpath($dir);
echo $install_folder;
Run this script as a regular user, and then as the user running the web site.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | General Grievance |
