php cli

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

can anyone tell me how to configure php cli with mysql support? i;ve  
tried adding defaul username, password and host in /etc/php5/cli/
php.ini but this didnt work.

php-m does not list mysql.

php version is 5.1.6 running on Ubuntu 6.10 with Apache/2.0.55

many thanks,


Re: php cli

lukemack wrote:
Quoted text here. Click to load it

PHP doesn't know where the ini file is when run from the cli, so your  
MySQL (or any other) extension is never getting loaded.

    php -c /path/to/php.ini

Note this doesn't have to be the same one that Apache uses.

Re: php cli

Hash: SHA1

Carl Pearson wrote:

Quoted text here. Click to load it

Yes, it does:

ivan@littlespark:~$ echo "<?php phpinfo(); ?>" | php5 | grep ini

Configuration File (php.ini) Path => /etc/php5/cli/php.ini
Scan this dir for additional .ini files => /etc/php5/cli/conf.d
additional .ini files parsed => /etc/php5/cli/conf.d/curl.ini,

So you have to make sure that /etc/php5/cli/php.ini loads the

- --  
- ----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
Proudly running Debian Linux with 2.6.17-1-686 kernel, KDE3.5.3, and PHP
5.2.0-8 generating this signature.
Uptime: 23:41:51 up 1 day, 10 min,  1 user,  load average: 0.10, 0.11, 0.09

Version: GnuPG v1.4.6 (GNU/Linux)


Re: php cli

thanks - i edited php.ini to load mysql.ini and it works now.

thanks for your help,


On 27 Jan, 22:42, Iván Sánchez Ortega <ivansanche...@rroba--> wrote:
Quoted text here. Click to load it
Quoted text here. Click to load it

Re: php cli

lukemack wrote:
Quoted text here. Click to load it

Uhm, MySQL wasn't working in Apache either?  You never mentioned that.

MySQL should have already been loading in php, you were talking about  
CLI usage like it was giving you different behavior, so I was thinking  
it was a path problem (php not finding the ini).  Sorry for the  

Re: php cli

i was talking about cli only. slight typo there - should have said in the php.ini in the cli folder. i did mean cli  
functionality only - mysqsl was working fine in apache.

Quoted text here. Click to load it

Site Timeline