Last modified: 2011-09-18 06:39:39 UTC
I am trying to update installation of older MediaWiki (probably 1.17a) via maintenance/update.php at 32-bit Windows computer. I've already updated to current trunk. Also, I should mention that the same box has MediaWiki 1.15.4 running just fine. However, I get the following fatal error when trying to run php update.php from cmd.exe console: c:\www\phase3\maintenance>php update.php MediaWiki 1.19alpha Updater PHP Fatal error: Call to undefined function mysql_error() in C:\www\phase3\includes\db\DatabaseMysql.php on line 245 My first guess is that mysql module is unavailable. It looks so: c:\www\phase3\maintenance>php -m [PHP Modules] bcmath calendar com_dotnet Core ctype date dom ereg filter ftp hash iconv json libxml mcrypt mhash mysqlnd odbc pcre PDO Phar Reflection session SimpleXML SPL standard tokenizer wddx xml xmlreader xmlwriter zip zlib However I do not compile PHP for Windows myself, it is usual binary package downloaded from php.net mirror: c:\www\phase3\maintenance>php -v PHP 5.3.3 (cli) (built: Jul 21 2010 20:03:25) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies Not very new one, I must admit, however 5.3.3 should be supported and why it runs 1.15.4 at the same box? However, php update.php performed in 1.15.4 installation directory gives a cleaner error message: c:\www\psychologos\maintenance>php update.php MediaWiki 1.15.4 Updater DB connection error: MySQL functions missing, have you compiled PHP with the --with-mysql option? But why does it run in http server mode? Aren't maintenance scripts using the same Database classes? I remember that php offers separate configs for CLI and SAPI modes, however it seems not the case: c:\www\psychologos\maintenance>php --ini Configuration File (php.ini) Path: C:\Windows Loaded Configuration File: C:\Windows\php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none) Please forgive my ignorance, in case the resolving is trivial.
Ok, I recall that php mysql module should be downloaded and installed separately. Still why does 1.15.4 runs in SAPI mode without it, but not in the CLI mode?
Ooops.. phpinfo() in SAPI mode shows that mysql module exists! Why in the world there is no such module listed in php -m output. Weird.
You are using the "MySQL native driver for PHP - mysqlnd" rather than the more usual "mysql" It might be possible that only when running php update.php that it reaches an error condition, and only then it tries to call it, and then falls over
(In reply to comment #3) > You are using the "MySQL native driver for PHP - mysqlnd" rather than the more > usual "mysql" > > It might be possible that only when running php update.php that it reaches an > error condition, and only then it tries to call it, and then falls over mysqlnd should still support the mysql_* functions.
There is ext/php_mysql.dll in php base installation directory and c:\windows\php.ini contains extension=php_mysql.dll extension=php_mysqli.dll uncommented. My thought was maybe there is collision between mysqlnd and php_mysql.dll. I've commented it out. Does not work anyway. Maybe php 5.3.3 for Windows bug. I'll try to update to 5.3.8 when I have more time. I think there was no problem in Linux, however I'll try again later and report. But a cleaner message like it was in 1.15.4 is preferred to fatal error in 1.19a.
PHP has a funny feature where it could use php.ini from different locations when running via mod_php and CLI. So the only 100% foolproof way to check PHP configuration is phpinfo() from the web and php -i from command line. Check output of php -i | grep -i mysql
There is only one ini-file being loaded: c:\temp>php --ini Configuration File (php.ini) Path: C:\Windows Loaded Configuration File: C:\lamp\php\php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none) Now a grepped part from php -i output: mysql MySQL Support => enabled Active Persistent Links => 0 Active Links => 0 Client API version => mysqlnd 5.0.7-dev - 091210 - $Revision: 300533 $ Directive => Local Value => Master Value mysql.allow_local_infile => On => On 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 => 3306 => 3306 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 It uses mysqlnd, as Chad correctly guessed. phpinfo() in SAPI mode also shows mysql module provided via mysqlnd mysqlnd 5.0.7-dev - 091210 - $Revision: 300533 $ the same version. However, in SAPI mode it works, while in CLI mode it fails with beforementioned message about non-existent mysql module. Looks like bug in PHP 5.3.3. to me.
There are two php.ini, C:\lamp\php\php.ini and a copy c:\windows\php.ini; however they are exact match (the same).
I've deleted C:\lamp\php\php.ini and now it works with mysql functions in CLI mode. The only mystery is, why did it fail, because ini files were binary match. Sorry for taking your time.