>Hi Gurus,
>
>I am using PHP 4.1.1, Postgresql 7.2  and Perl 5.6.0 on Linux.
>
>I want to execute a perl script throgh a PHP, which will take backup of the
>database after submit button on the PHP is clicked.
>
>I am using exec command, but as PHP runs as "nobody" user, it does not have
>access to Postgres database. So it creates a file of 0 byte.
>
>Can anybody tell me how to change user for execution of a particular PHP, or
>is there any other alternative.
>
>Thanking you in anticipation.

If you're going to do this from a web-page, you will need some kind of shell
script with 'sudo' (man sudo) permissions to do what needs to be done.

*OR* add a new mime-type to your httpd.conf that runs PHP as a CGI as the
'postgres' user which *does* have permission to do this.

*OR* alter the permissions of pg_dump to be world-executable, and of the
directory where the files are stored as well.

*OR* just pass in the username/password using -U to pg_dump (man pg_dump)

*OR* ...

There's a zillion ways to skin this cat, but which is least risky (or even
possible) depends on who can access the box, who can access the web page,
and whether or not you have root access on the box.

-- 
Like Music?  http://l-i-e.com/artists.htm


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to