Subject: php cli, mysql as non-root
To: pkgsrc-users@NetBSD.org <pkgsrc-users@NetBSD.org>
From: None <netbsd-users@rmroppert.de>
List: pkgsrc-users
Date: 08/14/2007 12:29:17
Hello,

an customer wants to run an php script as cron-job.
In this script there is an mysql query.

If i run the script from the commandline or as a cronjob as "root". it
works.
If i run it as the coustomers user. There is the error:

"Fatal error: Call to undefined function: mysql_connect() in...."

I use an extra php.ini for this script.
If i do
php -c (..php-ini..) -i  |grep mysql

i get this as root:
*********
Configure Command =>  './configure' '--without-mysql' '--without-iconv' '--without-pear' '--disable-posix' '--with-config-file-path=/etc' '--with-exec-dir=/usr/pkg/libexec/php4' '--with-regex=system' '--enable-ipv6' '--with-openssl=/usr' '--enable-discard-path' '--enable-force-cgi-redirect' '--prefix=/usr/pkg' '--host=i386--netbsdelf' '--mandir=/usr/pkg/man'
mysql
MYSQL_SOCKET => /tmp/mysql.sock
mysql.allow_persistent => Off => Off
mysql.connect_timeout => 60 => 60
mysql.default_host => no value => no value
mysql.default_password => no value => no value
mysql.default_port => no value => no value
mysql.default_socket => no value => no value
mysql.default_user => no value => no value
mysql.max_links => Unlimited => Unlimited
mysql.max_persistent => Unlimited => Unlimited
mysql.trace_mode => Off => Off
***********

and this as the customer user:
Configure Command =>  './configure' '--without-mysql' '--without-iconv' '--without-pear' '--disable-posix' '--with-config-file-path=/etc' '--with-exec-dir=/usr/pkg/libexec/php4' '--with-regex=system' '--enable-ipv6' '--with-openssl=/usr' '--enable-discard-path' '--enable-force-cgi-redirect' '--prefix=/usr/pkg' '--host=i386--netbsdelf' '--mandir=/usr/pkg/man'

It seems there is no mysql module for the user.

The ini-file is the same.
I use netbsd 3.1,

PHP 4.4.7 (cli) (built: Jul  5 2007 21:24:42)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
with eAccelerator v0.9.5, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

Has someone an idea how i get the php script working as cron for the user?

Best regards
Reinhold

--
R.M.Roppert