• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

Permissions Issue when creating a new Directory

One for the PHP Linux Gurus

I have a folder that is owned by the user XXXXX
Inside this we create new folders based on a Database Unique ID eg. 4433
We use PHP ... mkdir("4433",777)
Then files from elsewhere are copied to this directory

The problem is that when 4433 is created the Folder is owned by 99 which I am to believe is Nobody

how can I stop this happeneing?

This has only just started happening in the last 2 weeks.

HELP... this is causing major Production Issues
  • 4
1 Solution
what user runs the php program?
did you mean mkdir("4433",0777)

lawsoAuthor Commented:
Thats a good question.

Ther user that runs the PHP program should be XXXXX but now that you mention it I should ask the Hosting Company.

If I run this from the web browser what would the owner be?
lawsoAuthor Commented:
And sorry yes I meant mkdir("4433",0777)
Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

I suggest you try instead setting the permissions of the directory with the chmod command from within the script.
The PHP's chmod man page includes several examples of how to do this:
lawsoAuthor Commented:
OK I have worked out that this is not a security problem it is actually the fact that ImageMajick wasn't installed.

This is now installed... and it is still not working.

Do any of you guys have any experience with ImageMajick?

The original file XXX.JPG is written successfully to a directory and then ImageMajick is run to create several versions of the file. in different directories. Say /thumbnails/XXX.jpg etc

This is not happening and I don't know why.

This all worked on one server an is now not working on anothe supposedly identical server.
Any Ideas?

If it sounds like I am rambling it is because it is driving me crazy. This is the last problem in a long list of problems of moving server for a very popular web site... well at least where I live
lawsoAuthor Commented:

THe problem turned out to be that the Root Directory Structure for the Web App had changed and was not picking up the correct directory structure.

This happened moveing from a Shared Hosting environment to a Dedciated one
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now