Error running the maintenance commands :Could not open input file: artisan..⚠

Hi @hillel and @david. :smiley:

So… I have two questions which I hope you can be so kind and assist me with…

1.) Moved to new virtual server running Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-57-generic x86_64) and after installing and importing the old DB from the old server/finalizing the installation of Invoice Ninja.
After that I wanted to run the artisan optimize and migrate commands so I also could go ahead an upgrade to the newest version, but nope.

At first the ‘PHP’ command itself was not recognized at all so I ran:
apt install php8.1-cli

After that I cd to the folder:
cd /var/www/vhosts/somefolder and ran this command:
sudo php artisan optimize

I’m receiving this error:
artisan optimize. Could not open input file: artisan

So any idea on how to fix this? :thinking:

2.) Now a related issue is that on the old VPS server we had it ran only Apache over C-panel so I used this after an upgrade:

sudo -u www-data php artisan migrate

But the new VPs has Plesk which runs simultaneously both Nginx and Apache web server, so I am totally lost on how the command should be formatted because the apache owner www-data isn’t used with Plesk’s webserver owner which is called something completely different.

Any help on this would also be greatly appreciated so I can run the upgrade too…

Thanks in advance.

  1. Are you running the command from inside the folder for the app?

  2. @david any thoughts?

Once you understand which webuser is being used for the application, you can configure the appropriate user in the command.

If you navigate to the invoice ninja directory, and run

ls -l

It will display the list of files and will show the associated user/group

Hi David.
I ran the command ls -l and here is the output:

I also found this guide in the Plesk documentation:

It seems that you cannot just run it in one go as there is several file/folder users which is not the case in a normal server (Raw Linux/Linux C-panel or even a Windows server), where data is just owned by www-data or IUSR_ in ISS?

The obvious question here of course is how you format the artisan maintenance command for Plesk which is a bit of a conundrum to me still.

Yes, just like I did on my older server. But that was just simple “raw” Linux server so it just did it straight away. On Plesk as you could see not so much where it gives you there error:

Could not open input file: artisan

So made some changes and logged in directly as root ran the artisan command and this happens:

So that confirms that this method clearly doesn’t work on a Plesk server it seems? :thinking:

Hmm after searching i found this:
–and this one–

I’m going to try and test it. :wrench:

Ok success!
I´ve figured it out.

So in Plesk Control Panel you need to head to:
Home >>>* Subscriptions >>> @ username >>> Websites & Domains:


Now when the new window loads chose in the drop down menu:

And then after that is done:
Head for your favorite SHH client like Bitwise Simple URL Shortener which is my fav :smirk: for example and login with your Plesk subscription ftp/SHH user and…

Run the maintenance commands:

Now fetch a :beer: (or :coffee:) and pat yourself on the back for job well done! :smiley:

Cheers guys!