Migrate not working due to wrong path in vendor/bin/phinx?

CMS Version: 2.23 (also earlier versions)
Installation Method: Custom
Operating System: Linus (hosted)

Issue

When running “vendor/bin/phinx migrate -c phinx.php” (as described in Upgrade Manual) nothing happend and i was stuck in “maintainance mode”.

The file “error_log” shows “No such file or directory in /…/xibo/vendor/bin/phinx on line 27”

An that’s correct:
The file /…/xibo/vendor/bin/phinx shows a wrong path for require on line 27:

Original line 27: $app = require DIR . ‘/…/app/phinx.php’;

Solution

I changed this line to…
$app = require DIR . ‘/…/robmorgan/phinx/app/phinx.php’;
…and the migration worked.

I found other solutions, where some folders from the folder “vendor/robmorgan” are copied around and some config files are to be changed; but maybe this is the “easiest / fastest” solution !?

Future?

Could this line be changed in future versions “by default” ?

Thanks for the report and welcome back.

vendor/bin/phinx it produced by composer according to the phinx project’s configuration, we can’t actually change that file on our side.

I’m not sure how they produce that PHAR file (see it here: https://github.com/cakephp/phinx/blob/master/bin/phinx)

What is strange is that our Docker install uses /var/www/cms/vendor/bin/phinx migrate -c /var/www/cms/phinx.php command without any issues - as we do on our development environments.

Strange!

Hi

The command itself (…vendor/bin/phinx migrate -c …) is okay but the path in the require statement inside the phinx (line 27) is wrong. The only way the given path ([currDir]/…/app/phinx.php) would be correct ist, if you startet phinx from …/robmorgan/phinx/[anySubDir] as far as i think what DIR [with 2 underscores before / after] st used for)…
I will “play around” and build another “phinx” (manually) that takes …migrate -c [pathToCms]phinx.php; maybe that works better and we don’t have to change anything…

So my idea:

  • cd to …robmorgan/phinx/app
  • call [pathToCms]/vendor/bin/phinx migrate -c [pathToCms]/phinx.php
    …and looking as what the DIR is interpreted then :wink:

Tested: so the DIR is taken as [dir where “phinx” resides / is called] - no solution this way ;-(

but: [DirToXibo]/vendor/robmorgan/phinx/bin/phinx migrate -c phinx.php works…!
(works = see that script was startet and writes some lines back to my terminal)
…will test again on next update!

I know why it felt odd to me - vendor/bin/phinx is a symlink to vendor/robmorgan/bin/phinx, so I guess it might be a problem with that?

It certainly works everywhere i’ve tried it, so perhaps environment specific?

Yeah - “symlink” makes sense :wink:
I habe “my” solution (on hosted environment) and will look for an easy solution for me (or just use the “longer line” from above) :wink:

Great - if you have the time to report an issue I am sure the Phinx project would be interested in finding out whats not working in your environment. :smile: but at least you have a workaround.

Just in case you’re wondering why we don’t just adopt your workaround - its a good question - essentially i’m worried that phinx might at some point change the way that phar file is generated and if we’re calling it in a non-standard way we end up with a broken install.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.