Fwd: Re: Unable to load a file

John Iliffe <[email protected]> Thu, 16 Jan 2025 19:30:23 -0500
Newsgroups gmane.comp.php.general
Message-ID <[email protected]>
Re-transmitted as the original never turned up on the list. My apologies if I just missed the
distribution.

John
======
-------- Forwarded Message --------
From: John Iliffe <[email protected]>
Reply-To: [email protected]
To: Jānis Elmeris <[email protected]>
Subject: Re: [PHP] Unable to load a file
Date: 2025-01-16 11:46:28 AM

OK, tried that, thanks for the suggestion.  Turns out it is a permission error on the font file:
-----
[16-Jan-2025 11:30:35 America/Toronto] PHP Warning:  file_get_contents(/usr/fpdf186/font/garamond-
pro.php): Failed to open stream: Permission denied in /usr/fpdf186/fpdf.php on line 1136
[16-Jan-2025 11:30:35 America/Toronto] Array
(
    [$path] => /usr/fpdf186/font/garamond-pro.php
    [content] => 
)
-----
but selinux is in permissive mode and the file permissions are:
  (httpd is running as user 'apache' which is essentially an unprivileged user)

  -rwxr-xr-x. 1 root root 3738 Jan  2 22:04 /usr/fpdf186/font/garamond-pro.php

so readable by anybody.  The directory permissions are:

  drw-rw-rw-. 2 root root  4096 Jan  2 22:04 .

so nothing blocking decent to the file.  Also, have to keep in mind that this works from the command
prompt.

This system (Rocky 9.5) does not use ACL's either so not that.  Anything I missed?  It still looks
to me like PHP and not an fpdf problem.
======
On Thu, 2025-01-16 at 09:51 +0000, Jānis Elmeris wrote:
> 
> You may try adding debugging: in fpdf.php on line 1136, at the beginning of the function:
> 
> 
> error_log(print_r(['$path' => $path, 'content' => file_get_contents($path),], true));
> 
> 
> And see whether you get the expected output in the log.
> Compare what you get when you run it with CLI and with the webserver.
> 
> 
> Also, I see there is a difference between "Garamond Pro-Regular.php" and "garamond-pro.php" in
> your examples. I guess it is because you collected the examples from different times when you were
> experimenting with the code?
> 
> 
> Regards,
> Janis
------snip-----