So the client I am working for right now is really big on load time speed, so we try to shave every micro second possible. We found a file the other day that was pulling some word press blogs and it was adding a solid second to the load time.
Now I didn't write that particular script and perhaps I can go optimize it later, but for now, what I did was make a script that writes the output of the wp script to another file, then I simply reference that file when we need it. We run a cron on the script I wrote so it checks the wp script every so often and outputs any updates if needed.
That obviously really made things faster but I just have never done it before so I am curious about it:
- obviously we have a file with 777 permissions, what are my security concerns for this?
- Is this a good strategy to cut down in the future when the processing doesn't have to be done at the time of load?
-
Related: programmers.stackexchange.com/q/137860/34530user34530– user3453003/09/2012 15:22:02Commented Mar 9, 2012 at 15:22
1 Answer 1
you shouldn't have 777 permissions on that file. change the file to be owned by the user your apache (or whatever webserver you're using) is running (for example wwwrun.www
on suse linux or www-data.www
on ubuntu). after this you can give read and write permissions just to that user (644
) - you don't need permissions for executing at all.
EDIT:
the commands to do this are
chown wwwrun.www myfile.txt
to change the owning user (wwwrun
) and user-group (www
)chmod 644 myfile.txt
to change the permissions (6
= read/write for owner,44
= just reading for everyone else)
-
I may need a little clarification on how to do this. Obviously changing permissions is not an issue, but I am unclear on "change the file to be owned by the user your apache is running" Learning something new every day, still very green on some of this server stuff.absentx– absentx03/08/2012 06:55:44Commented Mar 8, 2012 at 6:55
-
please see my edit and don't hesitate to ask if anything else remained unclearoezi– oezi03/08/2012 07:04:43Commented Mar 8, 2012 at 7:04
-
excellent, thanks so much. I'll post more questions if I run into any trouble.absentx– absentx03/08/2012 08:14:05Commented Mar 8, 2012 at 8:14