I would like to understand what is going on here. I've compiled and created the functions inside my database but for my propose it is not working. I would like to trigger a function to run a php script but it won't work here. Running my php script over terminal it works but calling sys_eval or sys_exec not.
$ psql -h 127.0.0.1 -p 5432 -U root
root-# select sys_exec('/usr/bin/php5 -e "/var/www/html/project/web/do_jobs.php" "/bin/cp /home/cassiano/Desktop/index.html /home/cassiano/"');
sys_exec
----------
0
(1 row)
And my test don't work, the php receive a parameter to run a system command and do others stuff. Running in shell the script works well.
root=# select sys_eval('echo $UID');
sys_eval
----------
(1 row)
It returns '1000'.
$ id
uid=1000(cassiano) gid=1000(cassiano) groups=1000(cassiano),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lpadmin),124(sambashare)
root=# select sys_eval('id');
sys_eval
------------------------------------------------------------------------
uid=118(postgres) gid=128(postgres) groups=128(postgres),107(ssl-cert)
(1 row)