I am using XAMPP 8.0.0 and currently testing on MacOS 11.0.1 (though later live version would use an older version of MacOS, still the issue is the same there).
I developed an app on XAMPP 8.0.0 and running Windows 10. Everything works just fine. The app grabs some log files and then does its thing with them. On Windows option the log files were copied to htdocs folder for testing. Now, when I moved the app to the live machine on MacOS, the app works but it cannot reach the files that now lie outside the htdocs folder (admittedly I did not test for a similar situation on Windows but that is not so important because I need this to work on MacOS).
Config (program and log file names changed):
- Code: Select all
// live/development specific settings
if(LIVE) {
// If site in live mode
define('SPOOLER_LOG_FILE', '/opt/program_name/var/tmp/logfile.log');
} else {
// If site is in development mode
define('SPOOLER_LOG_FILE', 'C:/xampp/htdocs/logfile.log');
}
The code breaks when I use file_exist() function to check things before continuing:
- Code: Select all
// Get the log file location and Load the log file contents into an array
if(file_exists(SPOOLER_LOG_FILE)) {
$spooler_log_array = load_tabbed_file(SPOOLER_LOG_FILE);
} else {
die('LOG NOT FOUND!');
}
Though running load_tabbed_file() function directly doesn't work, either.
Only time when I got the log file to load was when I copied one under htdocs but IRL that is not a solution since I need the code to reach into the program folder where the log files actually are and are updated.
I also tried creating symlinks with no luck as well, which seems a bit odd since it should work the same as as copying the actual file to htdocs that did work but since I know server config/htaccess has some symlinks settings as well, perhaps that could cause this (though config by default seems to support symlinks but I am not very familiar with this topic).
CHMOD and access rights for logs seem to be fine and not causing this. Also, the paths to files are real (checked times and times again) and working (for example can access via terminal using the same paths). It simply seems that XAMPP is unable to get to anything outside the htdocs folder and after hours of searching I haven't been able to find anything that could help.
XAMPP is pretty much in standard configuration, only added access to phpMyAdmin and changed the root password.
Log: /opt/program_name/var/tmp/logfile.log
htdocs: /opt/lampp/htdocs (or /Users/username/.bitnami/stackman/machines/xampp/volumes/root/htdocs as I grab the path via terminal)
And there is another folder I need to access as well with several XML and JPG files but same deal: /opt/program_name/var/jobs/foldername
I feel like slowly going mad over this and pretty sure someone can tell me what is the obvious I am missing here. Here's hoping.