A
A
Alexey Zhdanov2016-09-19 00:41:58
PHP
Alexey Zhdanov, 2016-09-19 00:41:58

How to assign permissions to delete file using php on apache2.2 server?

File deletion works from the shell, exec rm does not work from apache. (unlink too)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
X
xmoonlight, 2016-09-19
@lexprofess

1. sudo
2. stackoverflow.com/questions/8532304/execute-root-c...
3. Direct buffer input when running sudo via exec: so

S
Sam Stay, 2016-09-19
@savenko_egor

You just need to know from whom (user) PHP is running and set the same user as the owner of the file or add it to the required group.
https://vk.cc/5Cwljz - info from the forum.
How to properly execute exec in php? - my question and my own answer on this topic.

S
Slava Kryvel, 2016-09-19
@kryvel

look in the Apache settings from which user and group it runs. This is usually www-data:www-data
folders and files must have the appropriate permissions.
the simplest option is to change the ownership of the files with
chown -R /files/directory/*

A
Alexey Zhdanov, 2016-10-25
@lexprofess

In addition to transferring rights to the Apache user, it was necessary to set the rights to the "neighboring" site in the .htaccess file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question