Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP Datei löschen (aka unlink();)

Empfohlene Antworten

Veröffentlicht

Moin,

ich will eigentlich nur eine bestimmte Datei löschen..


if(file_exists($playfile)) {
if(unlink($playfile)) {
$status[0]++;
}
}
[/php]

file_exists() klappt auch noch. Ebenfalls klappt (an anderer Stelle) der lesende Zugriff auf die Datei.

Allerdings schmeisst mir PHP beim unlink() dann

[php]
Warning: unlink(audio/2008-11-01/b255bb6f1c34dd58.wav) [function.unlink]: Permission denied in /***/includes/functions.php on line 681

Die Dateirecht passen aber soweit:


netkiller@XXX:# ls -la b255bb6f1c34dd58.wav

-rwxr--r-x 1 www-data adm 580684 2008-12-15 22:21 b255bb6f1c34dd58.wav

AFAIR übernimmt PHP als Apache Modul den User, unter dem der Apache läuft. Das wäre dann www-data:

netkiller@XXX:/# ps -ef | grep apache

www-data  8302 29314  0 16:06 ?        00:00:00 /usr/sbin/apache2 -k start

www-data  8395 29314  0 16:12 ?        00:00:00 /usr/sbin/apache2 -k start

www-data  8455 29314  0 16:19 ?        00:00:00 /usr/sbin/apache2 -k start

www-data  8513 29314  0 16:21 ?        00:00:00 /usr/sbin/apache2 -k start

www-data  8521 29314  0 16:23 ?        00:00:00 /usr/sbin/apache2 -k start

www-data  8672 29314  0 16:32 ?        00:00:00 /usr/sbin/apache2 -k start

www-data  8673 29314  0 16:34 ?        00:00:00 /usr/sbin/apache2 -k start

www-data  8736 29314  0 16:36 ?        00:00:00 /usr/sbin/apache2 -k start

www-data  8758 29314  0 16:39 ?        00:00:00 /usr/sbin/apache2 -k start

www-data  8879 29314  0 16:47 ?        00:00:00 /usr/sbin/apache2 -k start

root      8884  2938  0 16:49 pts/1    00:00:00 grep apache

Systemumgebung:

- Debian Etch

- PHP 5.2.0-8+etch13

- Apache 2.2.3 (Debian)

Den Hinweis von PHP: unlink - Manual, dass es evtl. daran liegen könnte, dass die zu löschenden Datei in einer hierarchisch höheren Dateisystemebene liegt hab ich schon gefunden, allerdings bekomme ich auch mit dem im Link genannten Workaround dieselbe Rückmeldung.

Irgendjemand ne Idee?

Danke schonmal

gruss

dgr

  • Autor

Eine rauchen gehen hilft ..

wem fällt was auf? :D


netkiller@pandora:xxx/audio# ls -lah

insgesamt 240

drwxr-xr-x 9 www-data adm   4096 2009-02-12 15:00 .

drwxr-xr-x 6 root     root  4096 2009-03-05 16:55 ..

drwxr-xr-x 2 root     root 20480 2009-02-12 14:53 2008-09-01

Nach einem chown www-data:adm * -R gehts dann auch :rolleyes:

Manchmal sieht man halt den Baum vor lauter Wäldern nicht..

Dennoch danke fürs lesen ;)

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.