Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Pixelairport's avatar

Can not install PHP on Forge without SSH

We have a problem with Laravel Forge. We used SHIFT to upgrade to new Laravel Version. Now we also need a new PHP Version (8.2). But get an error, when we want to install it via Forge. It says "The repository is not updated" and "public key is not available". We also get a solution from Forge to ssh as root on the server to generate a key. But we cant. Because as I understand Forge, everything with the Server as root is done by forge. If we want to do it, we have to change the root password at the server and change some things at the server to do it. But then we had a problem with forge. We dont know how to go on. Hope somebody can help.

0 likes
6 replies
LaryAI's avatar
Level 58

To resolve the issue of installing PHP 8.2 on Laravel Forge without direct SSH access, you can follow these steps:

  1. Update the Repository: Ensure that your server's package list is up-to-date. This can be done through the Forge UI by running a custom command.

  2. Add the PHP Repository: You need to add the repository for PHP 8.2. This can also be done through the Forge UI.

  3. Install PHP 8.2: Finally, install PHP 8.2 using the Forge UI.

Here are the detailed steps:

Step 1: Update the Repository

  1. Go to your server on Laravel Forge.
  2. Navigate to the "Scripts" section.
  3. Add a new script with the following command to update the package list:
    sudo apt-get update
    
  4. Run the script.

Step 2: Add the PHP Repository

  1. In the "Scripts" section, add another script with the following command to add the PHP repository:
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    
  2. Run the script.

Step 3: Install PHP 8.2

  1. In the "Scripts" section, add another script with the following command to install PHP 8.2:
    sudo apt-get install -y php8.2
    
  2. Run the script.

Step 4: Set PHP 8.2 as the Default Version

  1. In the "Scripts" section, add another script with the following command to set PHP 8.2 as the default version:
    sudo update-alternatives --set php /usr/bin/php8.2
    
  2. Run the script.

Step 5: Verify the Installation

  1. In the "Scripts" section, add another script with the following command to verify the PHP version:
    php -v
    
  2. Run the script and check the output to ensure PHP 8.2 is installed and set as the default version.

By following these steps, you should be able to install PHP 8.2 on your Laravel Forge server without needing direct SSH access as root. If you encounter any issues, you can always refer to the Laravel Forge documentation or seek further assistance from the Laravel community.

Pixelairport's avatar

Do I have to install new PHP Versions manually? I thougt Forge will do all this for me?

MohamedTammam's avatar

Why do you need to an app key to update PHP version. You can update PHP version via Laravel Forge directly.

However, to generate app key you can run the command from the command line page in Laravel Forge

php artisan key:generate
Pixelairport's avatar

Laravel is working. The key is ok. I found out I also cant install older PHP versions via Forge UI. I tried 7.4 and also get the errors: Forge was not able to install PHP due to missing trusted keys.

RealWorldDev's avatar

I've now got this exact issue as well, did you manage to get it sorted out? I can't install a new version of php with forge and the new version of the api I'm deploying needs 8.2 minimum.

The only thing I can think of doing is creating a new server and switching things to use that but that's a massive bunch of time my client doesn't want to pay for as they are already paying for forge every month to handle this sort of thing.

pdmfc's avatar

Has anyone resolved the issue? I tried downgrading from 8.2 to 8.1, but Forge could not install older PHP.

Please or to participate in this conversation.