Composer not generating doctrine-migrations PHP file into vendor/bin directory

  amazon-ec2, doctrine, doctrine-migrations, php

I have inherited an old legacy system based off Yii 1.1 which has had multiple development teams working on it for the past 10 years so is a bit of a mess with little to no documentation.

Doctrine Migrations have been used in the past and I can get this working on Docker, however on the live EB/EC2 instance, the migrations files will not run from command line.

Command:

php vendor/bin/doctrine-migrations status

Throws error

PHP Warning:  require(/var/app/current/site/vendor/bin/doctrine-migrations.php): failed to open stream: No such file or directory in /var/app/current/site/vendor/bin/doctrine-migrations on line 8 

PHP Fatal error:  require(): Failed opening required '/var/app/current/site/vendor/bin/doctrine-migrations.php' (include_path='.:/usr/share/pear7:/usr/share/php7') in /var/app/current/site/vendor/bin/doctrine-migrations on line 8

Looking at my local environment versus the live server, no doctrine-migrations.php file has been created in vendor/bin on the dev server, which composer should have created and is the file being looked for. Composer install is run during build on every deployment but I can’t figure out why it is not auto-generating this file in the vendor/bin directory – just another file called doctrine-migrations which pretty much just requires doctrine-migrations.php:

#!/usr/bin/env php
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

require __DIR__ . '/doctrine-migrations.php';

Source: Ask PHP

LEAVE A COMMENT