phinx icon indicating copy to clipboard operation
phinx copied to clipboard

Phinx cmd doesn't work on all partitions in Windows

Open djordje opened this issue 14 years ago • 7 comments

I have Phinx installed trough composer in C:\PHPtools, so I have in my path C:\PHPtools\vendor\bin. I can use Phinx correctly on my C: drive, but as sun as I want to work on drive D: I got problem.

This is cmd output:

The system cannot find the path specified.
Could not open input file: D:\projects\test_app\app\migrations\phinx

I'm interested in using my tools system wide without installing it in projects. Any solution?

djordje avatar Oct 26 '12 20:10 djordje

Until fix Windows users can bypass this limitation with junction link projects from D: drive to C: drive.

djordje avatar Oct 28 '12 00:10 djordje

Hi @djordje,

Phinx still hasn't received official support for Windows (Refer to issue #16). I'm not sure if it actually works at all because I haven't tested it. Are you able to create/execute migrations?

Also could you tell me the exact command you are using to install Phinx via Composer? And you are calling the phinx command from within your D:\projects\test_app\app\migrations directory?

I have prioritized proper Windows support for the next milestone (0.1.5).

robmorgan avatar Oct 28 '12 10:10 robmorgan

@robmorgan

Phinx work correctly on Windows, I can create and execute migrations just fine.

I have composer and Phinx in my ENV Path, both on C: drive, located in:

  • composer -> C:\PHPtools, I have composer.bat and composer.phar
  • Any composer vendor bin -> C:\PHPtools\vendor\bin, there is phinx.bat

I have this setup because I don't want to have multiple copies of tools that wont be committed to server. I can use composer anywhere on C: and D: drives, and so on...

Phinx can be used on drive where it is located, in my case C:, I can add Phinx trough composer to any project and use it withoud adding it to ENV Path. Solution is junction link: Eg. mklink /j C:\projects D:projects so I can access projects as it were on C: and Phinx working like charm this way.

djordje avatar Oct 28 '12 11:10 djordje

@robmorgan

I've tested a little, looks like the problem is phinx.bat generated by composer in vendor/bin.

Original content was:

@echo off
pushd .
cd %~dp0
cd "../robmorgan/phinx/bin"
set BIN_TARGET=%CD%\phinx
popd
php "%BIN_TARGET%" %*

I've edit it to, and now it works as expected:

@ECHO OFF
SET BIN_TARGET=%~dp0\..\robmorgan\phinx\bin\phinx
php %BIN_TARGET% %*

djordje avatar Oct 28 '12 11:10 djordje

@djordje thanks for your fix. I'll test it this week. Is this more a composer specific bug though? I checked your pull request.

robmorgan avatar Oct 29 '12 10:10 robmorgan

@robmorgan It looks like composer bug, I think the problem is the way they proxy request (pushd/popd)...

djordje avatar Oct 29 '12 16:10 djordje

having trouble running on windows:

PS C:\projects\project1> vendor/bin/phinx.bat create MyNewMigration PHP Fatal error: Class 'Phinx\Console\PhinxApplication' not found in C:\projects\project1\vendor\robmorgan\phin x\bin\phinx on line 53 PHP Stack trace: PHP 1. {main}() C:\projects\project1\vendor\robmorgan\phinx\bin\phinx:0

Fatal error: Class 'Phinx\Console\PhinxApplication' not found in C:\projects\project1\vendor\robmorgan\phinx\bin \phinx on line 53

roboter avatar May 31 '13 12:05 roboter