font_file

  • Mein PHP-Script gab keinen Text aus. Nach dem ich das font_file ins
    Webverzeichnis kopiert habe, geht es mit dem 1. Beispiel.


    Woran kann es liegen dass das 2.Beispiel nicht funktioniert?


    PHP
    font_file = './DejaVuSans.ttf';  // geht
    // $font_file = '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf';  // geht nicht
    
    
    
    
    imagefttext($im, 28, 0, 46, 69, $weiss, $font_file, 'PHP Manual');
  • Wahrscheinlich limitiert dein PHP den Zugriff auf Verzeichnisse ausserhalb des Web Roots (Standardverhalten).


    Im Webserver oder PHP-Logfile steht dann etwas wie

    Code
    PHP Warning:  is_readable(): open_basedir restriction in effect. File(/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf) is not within the allowed path(s) [...]


    (Beispiel von nginx / php-fpm)


    Siehe auch: PHP: Beschreibung der php.ini-Direktiven des Sprachkerns - Manual

    CentOS 7 / nginx / php-fpm / postfix / rspamd / clamav / dovecot / nextcloud running on RS 1000 SSDx4 G8 / VPS 500 G8 / VPS 2000 G8 Plus

    Einmal editiert, zuletzt von sdellenb ()