Home > Archive > PHP Programming > January 2007 > php cli
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| lukemack 2007-01-27, 6:59 pm |
| hi,
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,
lukemack.
| |
| Carl Pearson 2007-01-27, 6:59 pm |
| lukemack wrote:
> hi,
>
> 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,
>
> lukemack.
>
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.
Try:
php -c /path/to/php.ini
Note this doesn't have to be the same one that apache uses.
| |
| Iván Sánchez Ortega 2007-01-27, 6:59 pm |
| -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Carl Pearson wrote:
> PHP doesn't know where the ini file is when run from the cli,
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,
/etc/php5/cli/conf.d/gd.ini,
/etc/php5/cli/conf.d/ldap.ini,
/etc/php5/cli/conf.d/mysql.ini,
/etc/php5/cli/conf.d/mysqli.ini,
/etc/php5/cli/conf.d/odbc.ini,
/etc/php5/cli/conf.d/pdo.ini,
/etc/php5/cli/conf.d/pdo_mysql.ini,
/etc/php5/cli/conf.d/pdo_odbc.ini,
/etc/php5/cli/conf.d/pdo_sqlite.ini,
/etc/php5/cli/conf.d/sqlite.ini
So you have to make sure that /etc/php5/cli/php.ini loads the mysql.so
extension.
- --
- ----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
http://acm.asoc.fi.upm.es/~mr/
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFFu9VwR56dWuhgxGgRAs55AKCqL3uefV8R
Y/cuy9Y0m0iF0CEwDwCfc94z
OmCucl+TBTyirDeCZpGb9W0=
=aeQv
-----END PGP SIGNATURE-----
| |
| lukemack 2007-01-28, 3:59 am |
| thanks - i edited php.ini to load mysql.ini and it works now.
thanks for your help,
lukemack.
On 27 Jan, 22:42, Iv=E1n S=E1nchez Ortega <ivansanche...@rroba--
escomposlinux.punto.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Carl Pearson wrote:
es:[color=darkred]
>
> ivan@littlespark:~$ echo "<?php phpinfo(); ?>" | php5 | grep ini
>
> Configuration File (php.ini) Path =3D> /etc/php5/cli/php.ini
> Scan this dir for additional .ini files =3D> /etc/php5/cli/conf.d
> additional .ini files parsed =3D> /etc/php5/cli/conf.d/curl.ini,
> /etc/php5/cli/conf.d/gd.ini,
> /etc/php5/cli/conf.d/ldap.ini,
> /etc/php5/cli/conf.d/mysql.ini,
> /etc/php5/cli/conf.d/mysqli.ini,
> /etc/php5/cli/conf.d/odbc.ini,
> /etc/php5/cli/conf.d/pdo.ini,
> /etc/php5/cli/conf.d/pdo_mysql.ini,
> /etc/php5/cli/conf.d/pdo_odbc.ini,
> /etc/php5/cli/conf.d/pdo_sqlite.ini,
> /etc/php5/cli/conf.d/sqlite.ini
>
> So you have to make sure that /etc/php5/cli/php.ini loads the mysql.so
> extension.
>
> - --
> - ----------------------------------
> Iv=E1n S=E1nchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
>
> http://acm.asoc.fi.upm.es/~mr/
> 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
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFFu9VwR56dWuhgxGgRAs55AKCqL3uefV8R
Y/cuy9Y0m0iF0CEwDwCfc94z
> OmCucl+TBTyirDeCZpGb9W0=3D
> =3DaeQv
> -----END PGP SIGNATURE-----
| |
| Carl Pearson 2007-01-28, 9:59 pm |
| lukemack wrote:
> thanks - i edited php.ini to load mysql.ini and it works now.
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
misunderstanding.
| |
| lukemack 2007-01-30, 3:59 am |
| i was talking about cli only. slight typo there - should have said
mysql.so in the php.ini in the cli folder. i did mean cli
functionality only - mysqsl was working fine in apache.
On 28 Jan, 15:01, Carl Pearson <jman_spam_trap_....@gmail.com> wrote:
> lukemack wrote:
>
> 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
> misunderstanding.
|
|
|
|
|