php cmd heeft geen mysql

Pagina: 1
Acties:
  • 108 views sinds 30-01-2008
  • Reageer

  • Megamind
  • Registratie: Augustus 2002
  • Laatst online: 01-02 18:42
Ik heb CentOS 4.4 met Apache 2.0.5.9 met php 5.2.3 gebuild met de volgende opties:

code:
1
./configure --with-apxs2=/usr/local/apache/bin/apxs --prefix=/usr/local/apache/php --with-mysql --with-config-file-path=/usr/local/apache/php --enable-force-cgi-redirect --disable-cgi --with-zlib --with-gettext --with-gd --enable-bcmath --enable-ftp --enable-mbstring --with-dom --with-ttf --enable-sockets


PHP werkt perfect, MySQL ook, via apache. Maar nu wil ik via de commandline een php script aanroepen dus zoiets als php script.php.

Maar nu heeft PHP opeens geen mysql support meer.
Alsik php -m doe krijg ik:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[ PHP Modules]
ctype
date
dom
filter
hash
iconv
json
libxml
pcre
PDO
pdo_sqlite
posix
Reflection
session
SimpleXML
SPL
SQLite
standard
tokenizer
xml
xmlreader
xmlwriter


Ook als ik php met mijn huidige INI file laad, krijg ik nogsteeds geen mysql. Hoe kan ik nou toch mysql support krijgen over commandline?

  • mithras
  • Registratie: Maart 2003
  • Niet online
Heb je deze feature list doorgekeken, en dan met name ook dit comment:
This took me all day to figure out, so I hope posting it here saves someone some time:
Your PHP-CLI may have a different php.ini than your apache-php. For example: On my Debian-based system, I discovered I have /etc/php4/apache/php.ini and /etc/php4/cli/php.ini
If you want MySQL support in the CLI, make sure the line
extension=mysql.so
is not commented out.
The differences in php.ini files may also be why some scripts will work when called through a web browser, but will not work when called via the command line.
Megamind schreef op donderdag 14 juni 2007 @ 17:36:
Ook als ik php met mijn huidige INI file laad, krijg ik nogsteeds geen mysql. Hoe kan ik nou toch mysql support krijgen over commandline?
Bedoel je dan hiermee je /etc/php5/apache/php.ini?

Verwijderd

Dat zou normaal gesproken wel zo moeten zijn. Kun je eens kijken of je niet toevallig een php executable ergens hebt waar je dat niet bedoeld had?
Wat geeft het volgende commando?
which php

En deze?
ldd $(which php)

Welke modules staan er in de module path? Heb je niet een aparte php.ini voor de cli gespecifieerd waarin de mysql module niet wordt geladen?

  • Megamind
  • Registratie: Augustus 2002
  • Laatst online: 01-02 18:42
Nou die heb ik dus ook die mysql.so erin staan, maar het komt dus voor bij PHP 5.

which PHP:
/usr/local/bin/php


php-v geeft wel de goede php 5.2.3

        libcrypt.so.1 => /lib/libcrypt.so.1 (0x00d05000)
        librt.so.1 => /lib/tls/librt.so.1 (0x00405000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x00d35000)
        libm.so.6 => /lib/tls/libm.so.6 (0x00cba000)
        libdl.so.2 => /lib/libdl.so.2 (0x00cb4000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x00d4a000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00cdf000)
        libxml2.so.2 => /usr/lib/libxml2.so.2 (0x0030e000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00cf1000)
        libc.so.6 => /lib/tls/libc.so.6 (0x00b87000)
        /lib/ld-linux.so.2 (0x00b6e000)


Het vreemde is dat mysql meegecompileerd is, maar deze NIET in de php executable wordt geladen.

  • frankivo
  • Registratie: Januari 2002
  • Laatst online: 02-06-2025
maakt ie niet toevallig gebruik van een andere php.ini, waar de mysql module niet in wordt geladen?

iRacing Profiel