OK to chown www-data.www-data?

Gilles Ganault gilles.ganault at free.fr
Tue Jul 27 16:33:31 MSD 2010


On Tue, 27 Jul 2010 14:11:22 +0200, Gilles Ganault
<gilles.ganault at free.fr> wrote:
>So I ran "chown -R www-data.www-data /var/www/nginx-default/" and the
>script ran successfully.

Sent the message too soon: The PHP5 script can create an empty
datafile, but can't do anything with it, with no error message:

==============
# cat nginx-default/sqlite3_pdo_test.php 
<?php 
        try
                {
          $dbh = new PDO('sqlite:dummy.sqlite'); 

          //Why does file remain empty?
          $dbh->exec("CREATE TABLE IF NOT EXISTS table (id INTEGER
PRIMARY KEY AUTOINCREMENT, name VARCHAR(255))"); 
          $dbh->exec("INSERT INTO table (name) VALUES ('dummy')");

          $dbh = null;
  } catch(PDOException $e) { 
      echo $e->getMessage();
  }
?>
==============
# ll
drwxr-xr-x  6 www-data www-data 4096 2010-07-27 14:21 nginx-default/
==============
# ll nginx-default/
drwxr-xr-x  6 www-data www-data 4096 2010-07-27 14:21 ./

drwxr-xr-x  3 root     root     4096 2010-07-27 13:00 ../

-rw-r--r--  1 www-data www-data    0 2010-07-27 14:21 dummy.sqlite

-rw-r--r--  1 www-data www-data  563 2010-07-27 14:21
sqlite3_pdo_test.php
==============

Since the file does get created, I guess access rights are correct, in
which case I have no idea why it can't create a table + add records.

FWIW, here's an output of "ps aux" to check for Nginx and PHP5-FPM:

==============
# ps aux | grep -i -e nginx -e php5 | grep -v grep
root       749  0.0  0.0   4796   696 ?        Ss   09:59   0:00
nginx: master process /usr/sbin/nginx

www-data   750  0.0  0.1   5428  1656 ?        S    09:59   0:00
nginx: worker process

root       790  0.0  0.5  49196  5580 ?        Ss   09:59   0:00
/usr/bin/php5-fpm --fpm-config /etc/php5/fpm/php5-fpm.conf
www-data   791  0.0  0.9  51112  9976 ?        S    09:59   0:00
/usr/bin/php5-fpm --fpm-config /etc/php5/fpm/php5-fpm.conf
www-data   792  0.0  0.8  50076  9132 ?        S    09:59   0:00
/usr/bin/php5-fpm --fpm-config /etc/php5/fpm/php5-fpm.conf
www-data   793  0.0  0.9  50600  9676 ?        S    09:59   0:00
/usr/bin/php5-fpm --fpm-config /etc/php5/fpm/php5-fpm.conf
www-data   794  0.0  0.9  50600  9672 ?        S    09:59   0:00
/usr/bin/php5-fpm --fpm-config /etc/php5/fpm/php5-fpm.conf
www-data   795  0.0  0.9  50592  9404 ?        S    09:59   0:00
/usr/bin/php5-fpm --fpm-config /etc/php5/fpm/php5-fpm.conf
www-data   796  0.0  0.9  50600  9680 ?        S    09:59   0:00
/usr/bin/php5-fpm --fpm-config /etc/php5/fpm/php5-fpm.conf
www-data   797  0.0  0.9  50600  9696 ?        S    09:59   0:00
/usr/bin/php5-fpm --fpm-config /etc/php5/fpm/php5-fpm.conf
www-data   798  0.0  0.9  50936  9836 ?        S    09:59   0:00
/usr/bin/php5-fpm --fpm-config /etc/php5/fpm/php5-fpm.conf
www-data   799  0.0  0.9  50620  9464 ?        S    09:59   0:00
/usr/bin/php5-fpm --fpm-config /etc/php5/fpm/php5-fpm.conf
www-data   800  0.0  1.0  51152 11156 ?        S    09:59   0:00
/usr/bin/php5-fpm --fpm-config /etc/php5/fpm/php5-fpm.conf
==============

Thank you for any hint.




More information about the nginx mailing list