Weer Posted July 29 Posted July 29 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 July 29 Posted July 29 (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 July 30 by wolstech Quote
Weer Posted July 31 Author Posted July 31 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.