Question

Package not installed on Linux

I was trying to install the php and laravel pkg on Linux Ubuntu, but everytime he shows this error package not installed use the latest version.

What should I do?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

alexdo
Site Moderator
Site Moderator badge
February 21, 2024

Heya,

You can use our article on How to setup a LAMP stack on Ubuntu 22.04 and just follow the steps for PHP to get it installed on your droplet:

https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-22-04#step-3-installing-php

You can include any additional packages to the install command as well. Once done you can check the PHP version with php -v

Hope that this helps!

KFSys
Site Moderator
Site Moderator badge
February 22, 2024

Heya,

If you’re encountering an error stating “package not installed use the latest version” while trying to install PHP and Laravel on Ubuntu, it’s likely that there are issues with the package versions or repository configurations. Here are the steps to troubleshoot and resolve this issue:

  1. Update and Upgrade Packages: First, ensure your package lists are up to date. Run these commands:
sudo apt update sudo apt upgrade
  1. Install PHP:

    • Check the PHP version available in your Ubuntu repository:
apt search php
-   Install the latest version of PHP available (for example, if the latest is PHP 8.0):
sudo apt install php8.0
-   Install necessary PHP extensions. Laravel requires some specific PHP extensions. You can install them with:
sudo apt install php8.0-xml php8.0-mbstring php8.0-mysql php8.0-sqlite3 php8.0-curl php8.0-gd
  1. Install Composer: Composer is a dependency manager for PHP, required for installing Laravel.

    • Download and install Composer by following the instructions on the official Composer website.
  2. Install Laravel: With PHP and Composer installed, you can install Laravel globally using Composer:

composer global require laravel/installer
Ensure that the Composer global bin directory is in your system's "PATH".
  1. Check PHP and Laravel Versions:

    • Verify PHP installation:
php -v
-   Verify Laravel installation:
laravel -v
  1. Troubleshooting:

    • If you are still receiving errors, it might be helpful to see the exact error messages. Errors can provide clues as to what might be going wrong.
    • Ensure that there are no conflicts between package versions and that your Ubuntu version supports the packages you’re trying to install.
    • Sometimes, adding a third-party PPA (Personal Package Archive) can help in getting the latest versions of PHP:
sudo add-apt-repository ppa:ondrej/php sudo apt update
-   After adding a new PPA, try installing PHP again.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.