Weer Posted Tuesday at 07:06 PM Posted Tuesday at 07:06 PM 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 Tuesday at 11:58 PM Posted Tuesday at 11:58 PM (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 Wednesday at 12:02 AM by wolstech Quote
Weer Posted 20 hours ago Author Posted 20 hours ago The dynamic paths are excellent for my situation. Thanks a lot for your help. 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.