Weer Posted 14 hours ago Posted 14 hours ago I have a website where I need to save and load some local data, which is done by php scripts. I noticed the following: When I manually run my php scripts, e.g. by typing their file name in a web browser, files are read and written to the httpdocs folder When the scripts are called via a scheduled task, files are read and written to the home folder. I both use scheduled tasks and manual script runs. Does anyone know a practical way how to deal with this? Quote
wolstech Posted 9 hours ago Posted 9 hours ago (edited) Use absolute paths to the files in the scripts instead of relative ones. Your home folder is at /home/weer.helioho.st/ so absolute paths would be in the form: /home/weer.helioho.st/httpdocs/filename.txt You can also make the path dynamic. This statement means "filename.txt in the same folder as the PHP file": dirname(__FILE__).'/filename.txt' Edited 9 hours ago by wolstech Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.