Page 1 of 1

Upgrade 3.0.x to 3.2 using CLI

Posted: Thu Aug 15, 2019 11:40 pm
by droberts
I'm struggling a bit with a 3.0.x to 3.2.7 upgrade. I followed the various procedures for upgrading here in the support documentation and forums (notably here: https://www.phpbb.com/support/docs/en/3 ... /upgrade3/). Unfortunately, when I went to the /install directory using my browser and tried to upgrade, PHPBB complained about a scripting time limit being detected and said to upgrade via CLI. I tried invoking the phpbbcli.php script with "install" and it complains about needing a "config-file." I tried pointing it at the config.php that I copied from my pervious installation, but it looks like it wants a YAML file of some sort. There are lots of different YAML files in the config directory, but I'm not sure which one it might want. Any advice? I can't seem to find another support topic that might address this exact case and I don't want to bork up my database permanently (yes, I did make a 3.0 backup first, worst case) by fiddling. Thanks!

Re: Upgrade 3.0.x to 3.2 using CLI

Posted: Fri Aug 16, 2019 12:20 am
by kinerity
Try this from the CLI: from your board's root, execute the following command php bin/phpbbcli.php --safe-mode db:migrate

Re: Upgrade 3.0.x to 3.2 using CLI

Posted: Fri Aug 16, 2019 12:28 am
by 3Di
droberts wrote:
Thu Aug 15, 2019 11:40 pm
I tried invoking the phpbbcli.php script with "install" and it complains about needing a "config-file." ... .... but it looks like it wants a YAML file of some sort.
Yes, there is a sample file in the docs folder.

install-config.sample.yml

But's to install a fresh board, not upgrade.

Re: Upgrade 3.0.x to 3.2 using CLI

Posted: Fri Aug 16, 2019 5:59 am
by warmweer
droberts wrote:
Thu Aug 15, 2019 11:40 pm
.... Unfortunately, when I went to the /install directory using my browser and tried to upgrade, PHPBB complained about a scripting time limit being detected and said to upgrade via CLI. I tried invoking the phpbbcli.php script with "install" and it complains about needing a "config-file." I tried pointing it at the config.php that I copied from my pervious installation, but it looks like it wants a YAML file of some sort. There are lots of different YAML files in the config directory, but I'm not sure which one it might want. Any advice? I can't seem to find another support topic that might address this exact case and I don't want to bork up my database permanently (yes, I did make a 3.0 backup first, worst case) by fiddling. Thanks!
No advice on CLI (I've never used it), but depending on how large your board it, it may still be possible to upgrade it the usual way on a personal webserver (on your PC) in which you can set (increase) the max_execution_time and max_input time.
If you don't have one set up yet (WAMP, DEVServer or similar), or have no experience then I'ld suggest usbWebserver (https://usbwebserver.yura.mk.ua/) 8.6.1 (php5.6) or 8.6.2 (php 7.1). Unpack and it's ready (configured) to use.

Re: Upgrade 3.0.x to 3.2 using CLI

Posted: Fri Aug 16, 2019 8:03 am
by EA117
I've never done specifically a phpBB 3.0.x to phpBB 3.2.x update with it, but the attached configuration file is how I've triggered a database-only update from the command line before.

Note the phpbbcli.php to be invoking here is the one which exists in the phpBB /install directory, which has a different command set than the /bin/phpbbcli.php.

And because you're doing a database-only upgrade and not a full installation (since presumably you've already copied all the phpBB 3.2.7 files into place, and only need to update the still-3.0.x database to 3.2.7), you're looking to invoke the "update" command rather than "install".

So copy this update-config.db-only.yml file to the /install directory. Then change the current directory to the /install directory, and invoke the command line:

php phpbbcli.php update update-config.db-only.yml


I presume you were able to make it through the STK database cleanup first, as part of the overall Upgrading from 3.0 to 3.2 steps and approach.


Just to save anyone a click, the contents of this configuration file are:

Code: Select all

updater:
    type: db_only
    extensions: []

Re: Upgrade 3.0.x to 3.2 using CLI

Posted: Fri Aug 16, 2019 4:36 pm
by droberts
kinerity wrote:
Fri Aug 16, 2019 12:20 am
Try this from the CLI: from your board's root, execute the following command php bin/phpbbcli.php --safe-mode db:migrate
I tried this and got:

Code: Select all

Fatal error: Uncaught Error: Call to undefined function phpbb\db\driver\mysql_query() in /.../phpbb/db/driver/mysql.php:189

Re: Upgrade 3.0.x to 3.2 using CLI

Posted: Fri Aug 16, 2019 4:38 pm
by droberts
EA117 wrote:
Fri Aug 16, 2019 8:03 am
I've never done specifically a phpBB 3.0.x to phpBB 3.2.x update with it, but the attached configuration file is how I've triggered a database-only update from the command line before.

Note the phpbbcli.php to be invoking here is the one which exists in the phpBB /install directory, which has a different command set than the /bin/phpbbcli.php.

And because you're doing a database-only upgrade and not a full installation (since presumably you've already copied all the phpBB 3.2.7 files into place, and only need to update the still-3.0.x database to 3.2.7), you're looking to invoke the "update" command rather than "install".

So copy this update-config.db-only.yml file to the /install directory. Then change the current directory to the /install directory, and invoke the command line:

php phpbbcli.php update update-config.db-only.yml


I presume you were able to make it through the STK database cleanup first, as part of the overall Upgrading from 3.0 to 3.2 steps and approach.


Just to save anyone a click, the contents of this configuration file are:

Code: Select all

updater:
    type: db_only
    extensions: []
I tried this and got:

Code: Select all

Fatal error: Uncaught Error: Call to undefined function phpbb\db\driver\mysql_query() in /...<<forum path>>.../phpbb/db/driver/mysql.php:189

Re: Upgrade 3.0.x to 3.2 using CLI

Posted: Fri Aug 16, 2019 7:09 pm
by Paul
In your config.php, replace mysql with mysqli, and run the command again

Re: Upgrade 3.0.x to 3.2 using CLI

Posted: Fri Aug 16, 2019 8:47 pm
by droberts
Paul wrote:
Fri Aug 16, 2019 7:09 pm
In your config.php, replace mysql with mysqli, and run the command again
OK, will do. Which command (there were two, one in install/ and the other in bin/)? Or either one (do they do the same thing)?

Re: Upgrade 3.0.x to 3.2 using CLI

Posted: Sat Aug 17, 2019 1:33 am
by kinerity
Official docs says this one: php bin/phpbbcli.php --safe-mode db:migrate

Re: Upgrade 3.0.x to 3.2 using CLI

Posted: Sat Aug 17, 2019 6:57 am
by Paul
droberts wrote:
Fri Aug 16, 2019 8:47 pm
Paul wrote:
Fri Aug 16, 2019 7:09 pm
In your config.php, replace mysql with mysqli, and run the command again
OK, will do. Which command (there were two, one in install/ and the other in bin/)? Or either one (do they do the same thing)?
You should use the one from install/. The other one will not work for upgrading from 3.0 properly

Re: Upgrade 3.0.x to 3.2 using CLI

Posted: Sat Aug 17, 2019 5:02 pm
by droberts
Paul wrote:
Sat Aug 17, 2019 6:57 am
droberts wrote:
Fri Aug 16, 2019 8:47 pm
Paul wrote:
Fri Aug 16, 2019 7:09 pm
In your config.php, replace mysql with mysqli, and run the command again
OK, will do. Which command (there were two, one in install/ and the other in bin/)? Or either one (do they do the same thing)?
You should use the one from install/. The other one will not work for upgrading from 3.0 properly
That worked! Thanks for all your help, @Paul. Much appreciated. Thanks to everybody else who contributed feedback as well. If nothing else, I have a better appreciation for how phpBB works.

Re: Upgrade 3.0.x to 3.2 using CLI

Posted: Sat Aug 17, 2019 7:37 pm
by EA117
Paul wrote:
Sat Aug 17, 2019 6:57 am
You should use the one from install/. The other one will not work for upgrading from 3.0 properly
Thanks for confirming; I couldn't really have said one way or the other. Truthfully I expected that the actual database migration result would have been the same in either case. If there was "something more" to invoking the actual installer/update code, I presumed it would be to benefit "something else" besides the database migration proper. Like the per-extension upgrade processing seen to be occurring, or just "other things the full interactive /install/app.php/update processing would have normally performed" in addition to "just" the actual database migration.

Has the https://www.phpbb.com/support/docs/en/3.2/ug/upgradeguide/upgrade3/ page always referred to php ./bin/phpbbcli.php db:migrate --safe-mode as the CLI alternative? It doesn't stick in my mind one way or the other. But if we think the /install/phpbbcli.php process may be necessary for this phpBB 3.0.x upgrade process, maybe its something we need a bug on to investigate and update the site document accordingly.