You just need to know who (user) and PHP runs the same user to put in the owners of the file or add to the group. https://vk.cc/5Cwljz - infa from the forum. How to run exec in php? - my question and my answer on this topic.
Mackenzie.Rogahn71 answered on July 4th 19 at 23:29
look in the settings of Apache what user and group it runs. Usually it is www-data:www-data
the folders and files needs to be a corresponding law.
the easiest way is to change the owner of files using
Shanny_Medhurst answered on July 4th 19 at 23:31
In addition to the transfer of rights to the Apache user, you need to configure rights at the neighboring site in the file .htaccess