0

I'm using the DigitalOcean terminal to try run a Phinx migration vendor/bin/phinx migrate -e development but I get the error "permission denied"

I have tried writing the command in different ways, I have made sure the data in my phinx.php is correct.

I'm really stuck, anyone have any experience with this?

Full Command:

root@webportal-project-name:/home/project/project-name# vendor/bin/phinx migrate -e development

Error:

-bash: vendor/bin/phinx: Permission denied

Phinx.php:

<?php

return
[
    'paths' => [
        'migrations' => '%%PHINX_CONFIG_DIR%%/db/migrations',
        'seeds' => '%%PHINX_CONFIG_DIR%%/db/seeds'
    ],
    'environments' => [
        'default_migration_table' => 'phinxlog',
        'default_environment' => 'development',
        'production' => [
            'adapter' => 'mysql',
            'host' => 'localhost',
            'name' => 'production_db',
            'user' => 'root',
            'pass' => '',
            'port' => '3306',
            'charset' => 'utf8',
        ],
        'development' => [
            'adapter' => 'mysql',
            'host' => 'localhost',
            'name' => 'customer_portal',
            'user' => 'root',
            'pass' => 'pK74He7NbqvNyFxz',
            'port' => '3306',
            'charset' => 'utf8',
        ],
        'testing' => [
            'adapter' => 'mysql',
            'host' => 'localhost',
            'name' => 'testing_db',
            'user' => 'root',
            'pass' => '',
            'port' => '3306',
            'charset' => 'utf8',
        ]
    ],
    'version_order' => 'creation'
];

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
ShlongMór
  • 45
  • 5
  • What are the permissions on `vendor/bin/phinx`? Does it perhaps need to be run as `root`? – underscore_d Sep 01 '20 at 10:32
  • @underscore_d I'm kinda new to using phinx and digital ocean, how can I check the permissions ? – ShlongMór Sep 01 '20 at 10:35
  • I mean the filesystem permissions, so for example do an `ls -Fal vendor/bin/phinx` to check which users/groups have permissions to the file. Or, if you're not using a Linux-like OS, use its file manager or terinal equivalent to check that. – underscore_d Sep 01 '20 at 10:39
  • @underscore_d Yes it returns `-rw-r--r-- 1 root root 356 Sep 1 08:40 vendor/bin/phinx` when i execute that command So how do i run it as root is the question – ShlongMór Sep 01 '20 at 10:44
  • You need to add execute permissions in any case, since that is presumably meant to be an executable binary. Since currently anyone can read, probably anyone should be able to execute too. A simple `chmod +x vendor/bin/phinx` should sort that. – underscore_d Sep 01 '20 at 10:48
  • I have ran that command but still get a ``permission denied` error when I run the migration command – ShlongMór Sep 01 '20 at 10:51
  • What does `ls` show for the permissions now? – underscore_d Sep 01 '20 at 11:36
  • @underscore_d `-rw-r--r-- 1 root root 356 Sep 1 08:40 vendor/bin/phinx*` and the vendor/bin/phinx is green – ShlongMór Sep 01 '20 at 11:43
  • Pass. I would expect to see `x`s in there and the executable not to be highlighted. I would recommend mentioning what OS, shell, etc you are using and see if anyone else knows. – underscore_d Sep 01 '20 at 11:44
  • @underscore_d `DigitalOcean Droplets are Linux-based virtual machines (VMs) that run on top of virtualized hardware. Each Droplet you create is a new server you can use, either standalone or as part of a larger, cloud-based infrastructure. DigitalOcean Droplets are managed using a terminal and SSH` – ShlongMór Sep 01 '20 at 11:46

0 Answers0