V4.5.5 installation files incomplete

I’m running a few self hosted installations of v4.5.5. Some of the installation files seem to be missing. This block me of doing a few things: I’m not able to white label the installation, neither am I able to use the migration tool to migrate the data to a new v5.x.x installation.

What’s missing a.o. are these directories and their files:
/public/white_label/*
/public/migration/*

Where can I get a complete v4.5.5, including all files/folders?

Hi,

The files for v4.5.50 can be found here:

https://web.archive.org/web/20240629063404/https://download.invoiceninja.com/ninja-v4.5.50.zip

Hi,

Thanks for the link to the files.

Unfortunately, the files/directories mentioned in my initial question are not there. When I try to either white label or migrate, InvoiceNinja tries to load files from the mentioned directories.

The white label function worked last year though.

When trying to white label, it wants to load https://admin.mundomatto.be/public/**white_label/purchase** on my domain, but the files are not there.

When trying to migrate, it wants to load https://admin.mundomatto.be/public/**migration/start** on my domain, but the files are not there.

What am I missing here? I’m not a coder, so I might be missing something…

Thanks.

Those are virtual routes defined in routes/web.php, you won’t see matching folders in the codebase.

Okay, got it, but how do I solve the actual issue?

Another issue seems to be that migrating isn’t even possible when you’re having v4.5.50 and v5.x.x on the same server, since you can’t run two php verions simultaneously. Currently on PHP v7.4 for v4.5.50.

I believe you should be able to configure the server to use different version of PHP for each of the apps.

Note: these instructions from ChatGT mention PHP 8.1, you’ll need >= 8.2.

If you have two Laravel apps on the same server and need them to use different PHP versions, you can achieve this by configuring your web server (Nginx or Apache) and using the correct PHP-FPM version for each app.


1. Check Installed PHP Versions

Run the following command to see which PHP versions are installed on your server:

ls /usr/bin/php*

or

php -v
php7.4 -v
php8.1 -v

If you need to install another PHP version, you can do so using:

sudo apt install php7.4 php7.4-fpm
sudo apt install php8.1 php8.1-fpm

2. Configure Nginx (Recommended for Laravel)

If you’re using Nginx, modify the server blocks for each app.

Example for App 1 (Using PHP 7.4)

server {
    listen 80;
    server_name app1.example.com;
    root /var/www/app1/public;

    index index.php index.html index.htm;
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~ /\.ht {
        deny all;
    }
}

Example for App 2 (Using PHP 8.1)

server {
    listen 80;
    server_name app2.example.com;
    root /var/www/app2/public;

    index index.php index.html index.htm;
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass unix:/run/php/php8.1-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~ /\.ht {
        deny all;
    }
}

After making these changes, restart Nginx:

sudo systemctl restart nginx

3. Configure Apache (If Using)

If you’re using Apache, modify the virtual hosts.

Enable Multiple PHP Versions

First, enable the PHP versions using:

sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.4-fpm
sudo a2enconf php8.1-fpm
sudo systemctl restart apache2

Set Different PHP Versions for Each App

Edit the Apache virtual host files for each app.

App 1 (Using PHP 7.4)
<VirtualHost *:80>
    ServerName app1.example.com
    DocumentRoot /var/www/app1/public

    <FilesMatch \.php$>
        SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
    </FilesMatch>

    <Directory /var/www/app1>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
App 2 (Using PHP 8.1)
<VirtualHost *:80>
    ServerName app2.example.com
    DocumentRoot /var/www/app2/public

    <FilesMatch \.php$>
        SetHandler "proxy:unix:/run/php/php8.1-fpm.sock|fcgi://localhost"
    </FilesMatch>

    <Directory /var/www/app2>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

After editing the configuration, restart Apache:

sudo systemctl restart apache2

4. Set CLI PHP Version Per Project

By default, the command-line PHP version may not match the web server’s PHP version. You can specify which version to use per project.

Inside App 1 (which uses PHP 7.4):

alias php="php7.4"

Inside App 2 (which uses PHP 8.1):

alias php="php8.1"

Alternatively, use update-alternatives:

sudo update-alternatives --set php /usr/bin/php7.4

or for PHP 8.1:

sudo update-alternatives --set php /usr/bin/php8.1

For project-specific CLI PHP version, you can use Laravel’s php binary path in commands:

/usr/bin/php7.4 artisan migrate

Conclusion

  • Use different PHP-FPM versions in your Nginx or Apache configurations.
  • Restart the web server after making changes.
  • Set the correct PHP version for CLI operations if needed.

Would you like help setting up Supervisor queues or cron jobs for each app with the correct PHP version? :rocket: