3

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?
asked Mar 8, 2012 at 4:50
1

1 Answer 1

5

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)
answered Mar 8, 2012 at 6:02
3
  • 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. Commented Mar 8, 2012 at 6:55
  • please see my edit and don't hesitate to ask if anything else remained unclear Commented Mar 8, 2012 at 7:04
  • excellent, thanks so much. I'll post more questions if I run into any trouble. Commented Mar 8, 2012 at 8:14

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.