Page MenuHomePhabricator

Cannot run 1.6 "update.php" script from commandline
Closed, ResolvedPublic

Description

Author: greg

Description:
I just checked out a clean copy of 1.6 via SVN using the following command:

svn co http://svn.wikimedia.org/svnroot/mediawiki/branches/REL1_6/phase3

I then copied across my LocalSettings.php file and moved the directory into place on the server.

No matter what I do, I am unable to run the update.php script from the command line. It always fails with some kind of error no matter which options I
supply.

php -cli ./maintenance/update.php
(fails: tries to connect to database without a password as the user running the script)

sudo -u apache php -cli ./maintenance/update.php
(fails: claims safe mode restriction in effect and cannot write to counter.php)

sudo -u apache php -cli -d safe_mode=0 ./maintenance/update.php
(fails: tries to connect to database without a password as user running the script)

sudo php -cli -d safe_mode=0 ./maintenance/update.php
(fails: tries to connect to database without a password as root)

sudo php -d safe_mode=0 ./maintenance/update.php
(fails: tries to connect to database without a password as root)

chown -R apache:apache .
sudo -u apache php -cli ./maintenance/update.php
(fails: longer complains about unwriteable counter.php but still tries connecting without a password as the user running the script)

sudo -u apache php -cli -d safe_mode=0 -d open_basedir=/ ./maintenance/update.php
(fails: tries to connect as user running the script)

I tried that last one because it was complaining a about a safe mode restriction and not being able to access the file where I store my database username
and password (which I've moved outside of the webroot for security reasons). When I add the "open_basedir=/" option it evidently reads the file, but it
ignores the settings inside and tries to connect as the user running the script, not the user specified in the settings. I tried copying the database username
and password into the LocalSettings.php file and it *still* tried connecting as the user running the script, so in all cases it is ignoring the settings in
LocalSettings.php.

I don't know why it is complaining about safe mode when I run this stuff from the command line. I know of no reason why that restriction would be in
effect. I doubt it has any effect on the command line, but safe mode is definitely turned off in my httpd.conf for my MediaWiki directory.

I don't really understand why it is so fiendishly difficult to upgrade. Sounds like a bug in the update procedure (possible) or a bug in the release/upgrade
instructions.


Version: 1.6.x
Severity: normal
OS: Linux

Details

Reference
bz5460

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:11 PM
bzimport set Reference to bz5460.
bzimport added a subscriber: Unknown Object (MLST).

robchur wrote:

(In reply to comment #0)

php -cli ./maintenance/update.php
(fails: tries to connect to database without a password as the user running

the script)

  1. Read http://www.mediawiki.org/wiki/Help:Upgrading_to_1.6
  2. You need to set up an AdminSettings.php file in the wiki root
  3. Run update.php *from within the maintenance dir* to be sure

greg wrote:

Many thanks for providing the link, Rob. The missing AdminSettings.php file was the problem. My first attempt failed
because my database user didn't have enough privileges to create/alter tables etc, so I temporarily escalated those
privileges. But I did also discover a bug in the update.php script.

Running it from inside the maintenance directory (ie. with "php ./update.php") or from outside the maintenance directory
(ie. with "php maintenance/update.php") I got this error both times:

Making wl_notificationtimestamp nullable... <br />
<b>Warning</b>: fopen(maintenance/archives/patch-watchlist-null.sql): failed to open stream: No such file or directory
in <b>/home/greghurrell.net/public_html/salsawiki/includes/Database.php</b> on line <b>1671</b><br />
Could not open "".

In other words it was looking for a file at "maintenance/archives/patch-watchlist-null.sql" *inside* the maintenance
directory (ie. at "maintenance/maintenance/archives/patch-watchlist-null.sql"). As a quick work around, I made those
subdirectories and copied in the missing file, and the update.php script then worked.

robchur wrote:

(In reply to comment #2)

Running it from inside the maintenance directory (ie. with "php ./update.php")

or from outside the maintenance directory

(ie. with "php maintenance/update.php") I got this error both times:

Making wl_notificationtimestamp nullable... <br />
<b>Warning</b>: fopen(maintenance/archives/patch-watchlist-null.sql): failed

to open stream: No such file or directory

in <b>/home/greghurrell.net/public_html/salsawiki/includes/Database.php</b> on

line <b>1671</b><br />

Could not open "".

That's a known bug which I am, this second, committing the fix for. I'm going to
mark this resolved now, too.