PHP jogando permissão negada erro para um arquivo em um diretório

1

Recentemente, mudei um site do Ubuntu para o Centos e comecei a notar que os usuários exibiam uma página de resposta em branco depois de realizar as transações. Os logs do Apache tinham essas mensagens.

[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

Verificando ls -lZ para cada um desses diretórios eu tive as seguintes saídas

[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

Não tenho certeza do que poderia estar errado. Gostaria de receber sugestões para resolver isso.

    
por sridhar pandurangiah 16.07.2013 / 18:56

1 resposta

2

Esses arquivos não são de propriedade do apache, portanto, você precisará chmodar os arquivos fonts / *. afm para + w para outros para dar permissões de gravação ao apache ( chmod 666 fonts/*.afm ). Como alternativa, forneça a propriedade ao apache ( chown apache fonts/*.afm ).

Você também pode definir a propriedade adequada de arquivos para todos eles. Como parece não conseguir encontrar o nome de usuário para esse usuário # 1001.

    
por 16.07.2013 / 19:07