Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6690879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:41:15+00:00 2026-05-26T05:41:15+00:00

If a PHP script on the server can’t create a directory, is this usually

  • 0

If a PHP script on the server can’t create a directory, is this usually because PHP is running as apache/nobody? So can you say from this that the server is misconfigured? (or just using the standard configuration)

For security purposes it would be better if php was running as the user, and if it was, would this problem (requiring 777) still occur? I don’t think so but I thought I’d ask…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:41:15+00:00Added an answer on May 26, 2026 at 5:41 am

    So can you say from this that the server is misconfigured?

    No. That’s how it’s supposed to be. php scripts executed by apache run as user www-data (on Ubuntu). www-data has practically no writing rights on the entire server. And that’s how it’s supposed to be. If you write an even slightly insecure php script (e.g. susceptible to code injection) and it’s being run as root, a malicious visitor could wipe out your entire hard drive.

    For security purposes it would be better if php was running as the user?

    Who do you mean by the user? If it’s root, see above. If it’s a user with root privileges, see above.

    Would this problem (requiring 777) still occur?

    The problem is that you’re using code that needs full reading, writing and executing permission on a foreign directory.

    If it’s a directory that will only be used by your script, www-data should own it. Problem solved.

    If you’re using a php script that has to have access to sensitive system areas, you may want to rethink the way of doing this. Many tasks that a php script is supposed to execute could be scheduled by the script and later executed by a cron job.

    Last but not least, if you you absolutely have to, you can run php as any user you want. Just install the module mpm_itk_module and add

        AssignUserId user group
    

    inside the <VirtualHost> tag.

    But be aware that – as I said before – with a bad script and the wrong privileges, Very Bad Things (TM) could happen.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running a php script from the command line against SQL server 2005 using
The server my PHP script is running on is set to UTC. I can't
I can't understand why this PHP script gives me 500 internal server error. $query
How can I receive the Zend Server version by a PHP script running on
I have a PHP script (running on a Linux server) that ouputs the names
I have a PHP script that fetches an image from a remote server so
How can we compress php script before upload to main server so that our
I'm looking for a PHP script that I can install on my own server
I need to send 500 Internal Server Error from an PHP script under certain
My PHP script writes to a file so that it can create a jpg

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.