You need to delete the file on another subdomain on the same server. That is, the php-delete script is called on one subdomain (dom1.site.ru), and the file is on the other.

The following thing indicating the full server path did not help:

unlink("/var/www/user/data/www/dom2.site.ru/img/1.jpg"); 

How to be?

  • one
    Are these sites on the same physical machine? - KoVadim
  • @KoVadim, yes, I wrote. - Rammsteinik
  • What error did unlink give? Maybe it's just not enough rights, or it is used for the chroot site, and it does not see anything above its root ... - Johny
  • @Sergiks, that is, can be removed only by running pkhp on the same site? - Rammsteinik

1 answer 1

Differently, happens, configure the server.

Alternatively, you can still try to specify the relative path from the script: ../../dom2.site.ru/img/1.jpg

But this is all speculation.

Update

One can only guess:

  1. For sites, php runs from chroot and therefore it is impossible to get out of it.
  2. php runs under different users for each subdomain, and therefore there is no permission to modify / delete that file.

Crutch: make a script on the second site that will delete the file "at itself" and pull it through HTTP. Think over security: make sure that only from the same ip you can call him.

  • one
    @Sergiks, oddly enough, worked. ) I foolishly wrote at the beginning .../dom2.site.ru/img/1.jpg , I didn’t just come across the directory above. - Rammsteinik