最近,我将一个网站从 Ubuntu 迁移到 Centos,并开始注意到用户在执行交易后会看到一个空白的响应页面。Apache 日志中有这些消息。
[Mon Jul 15 02:15:58 2013] [error] [client 173.24.242.72] PHP Warning: file_put_contents(/home/sridhar/public_html/mysite.com/public/pgway_icici/dompdf/lib/fonts/php_Helvetica.afm): failed to open stream: Permission denied in /home/sridhar/public_html/mysite.com/public/pgway_icici/dompdf/lib/class.pdf.php on line 2354
[Mon Jul 15 02:15:58 2013] [error] [client 173.24.242.72] PHP Warning: file_put_contents(/home/sridhar/public_html/mysite.com/public/pgway_icici/dompdf/lib/fonts/php_Helvetica-Bold.afm): failed to open stream: Permission denied in /home/sridhar/public_html/mysite.com/public/pgway_icici/dompdf/lib/class.pdf.php on line 2354
[Mon Jul 15 02:15:58 2013] [error] [client 173.24.242.72] PHP Warning: file_put_contents(/home/sridhar/public_html/mysite.com/public/pgway_icici/dompdf/lib/fonts/php_Helvetica-Bold.afm): failed to open stream: Permission denied in /home/sridhar/public_html/mysite.com/public/pgway_icici/dompdf/lib/class.pdf.php on line 2354
[Mon Jul 15 02:15:58 2013] [error] [client 173.24.242.72] PHP Warning: file_put_contents(/home/sridhar/public_html/mysite.com/public/pgway_icici/dompdf/lib/fonts/php_Helvetica-Bold.afm): failed to open stream: Permission denied in /home/sridhar/public_html/mysite.com/public/pgway_icici/dompdf/lib/class.pdf.php on line 2354
[Mon Jul 15 02:15:58 2013] [error] [client 173.24.242.72] PHP Warning: file_put_contents(/home/sridhar/public_html/mysite.com/public/pgway_icici/dompdf/lib/fonts/php_Helvetica.afm): failed to open stream: Permission denied in /home/sridhar/public_html/mysite.com/public/pgway_icici/dompdf/lib/class.pdf.php on line 2354
[Mon Jul 15 02:15:58 2013] [error] [client 173.24.242.72] PHP Warning: file_put_contents(/home/sridhar/public_html/mysite.com/public/pgway_icici/dompdf/lib/fonts/php_Helvetica.afm): failed to open stream: Permission denied in /home/sridhar/public_html/mysite.com/public/pgway_icici/dompdf/lib/class.pdf.php on line 2354
检查每个目录的 ls -lZ ,我得到以下输出
[root@i-8941-35408-VM pgway_icici]# ls -lZ dompdf
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t ChangeLog
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t dompdf_config.inc.php
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t dompdf.php
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t HACKING
drwxr-xr-x 1001 1001 user_u:object_r:httpd_sys_content_t include
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t INSTALL
drwxr-xr-x 1001 1001 user_u:object_r:httpd_sys_content_t lib
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t LICENSE.LGPL
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t load_font.php
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t README
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t TODO
[root@i-8941-35408-VM pgway_icici]# ls -lZ dompdf/lib
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t class.pdf.php
drwxr-xr-x 1001 1001 user_u:object_r:httpd_sys_content_t fonts
drwxr-xr-x 1001 1001 user_u:object_r:httpd_sys_content_t res
[root@i-8941-35408-VM pgway_icici]# ls -lZ dompdf/lib/fonts
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t Courier.afm
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t Courier-Bold.afm
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t Courier-BoldOblique.afm
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t Courier-Oblique.afm
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t dompdf_font_family_cache
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t dompdf_font_family_cache.dist
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t Helvetica.afm
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t Helvetica-Bold.afm
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t Helvetica-BoldOblique.afm
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t Helvetica-Oblique.afm
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t Times-Bold.afm
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t Times-BoldItalic.afm
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t Times-Italic.afm
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t Times-Roman.afm
-rw-r--r-- 1001 1001 user_u:object_r:httpd_sys_content_t ZapfDingbats.afm
不确定哪里出了问题。如果能提出任何建议来解决这个问题,我将不胜感激。
答案1
这些文件不属于 apache,因此,您需要将 fonts/*.afm 文件的 chmod 设置为 +w 到 other,以便为 apache ( chmod 666 fonts/*.afm
) 授予写入权限。或者,将所有权授予 apache ( chown apache fonts/*.afm
)。
可能还需要为所有这些文件设置适当的文件所有权。因为似乎无法找到这些用户# 1001 的用户名。