Re: PHP files and server directory ownership under Ubuntu/Ap…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Keith Smith via PLUG-discuss
Date:  
To: Main PLUG discussion list
CC: techlists
Subject: Re: PHP files and server directory ownership under Ubuntu/Apache2

Thanks!!

What would "elevated access" be?


On 2024-10-17 13:10, Stephen Partington via PLUG-discuss wrote:
> if you want apache to run them then making the files owned by apache
> is what you will need. or whatever apache user. if you need elevated
> access then it will get stranger.
>
> On Thu, Oct 17, 2024 at 4:09 PM Keith Smith via PLUG-discuss
> <> wrote:
>
>> Hi,
>>
>> I have several Ubuntu 24.04lts servers setup on virtual box.
>>
>> I am wondering about PHP file ownership and directory ownership.
>>
>> It is my understanding on a Ubuntu server running Apache2 that the
>> PHP
>> files and the Docroot directories should be owned by the Apache user
>> and
>> group - www-data.
>>
>> I asked AI and it said : "Yes, for a PHP script to be able to write
>> to
>> the server (like creating files, logging, etc.) when running under
>> Apache, the file must be owned by the user that the Apache server
>> runs
>> as, which is typically www-data on Ubuntu."
>>
>> AI also gave the following:
>>
>> sudo chown www-data:www-data /path/to/your/script.php
>>
>> sudo chown -R www-data:www-data /path/to/your/directory
>>
>> sudo chmod 644 /path/to/your/script.php
>>
>> sudo chmod 755 /path/to/your/directory
>> ---
>>
>> Any thoughts are much appreciated.
>>
>> Keith
>>
>> ---------------------------------------------------
>> PLUG-discuss mailing list:
>> To subscribe, unsubscribe, or to change your mail settings:
>> https://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
> --
> A mouse trap, placed on top of your alarm clock, will prevent you from
> rolling over and going back to sleep after you hit the snooze button.
>
> Stephen
> ---------------------------------------------------
> PLUG-discuss mailing list:
> To subscribe, unsubscribe, or to change your mail settings:
> https://lists.phxlinux.org/mailman/listinfo/plug-discuss

---------------------------------------------------
PLUG-discuss mailing list:
To subscribe, unsubscribe, or to change your mail settings:
https://lists.phxlinux.org/mailman/listinfo/plug-discuss