DEV Community

rkcperea
rkcperea

Posted on • Edited on

Getting Started with PHP Laravel on Ubuntu 24.04

I'm documenting how to install Laravel on Ubuntu 24.04, currently in progress.

I tried following Laravel documentation, but below didn't work for me:

/bin/bash -c "$(curl -fsSL https://php.new/install/linux/8.4)"
Enter fullscreen mode Exit fullscreen mode

If you did, you might need to uninstall first with:

~/.config/herd-lite/bin/uninstall-herd-lite
Enter fullscreen mode Exit fullscreen mode

and remove the path changes in ~/.bashrc

Learning from git

Since we have a #learning tag, this is what I normally do

  • with this, we are aware of caveats, open issues, trends, etc.

First, go to php-src

run the following commands

sudo apt install --dry-run pkg-config build-essential autoconf bison re2c libxml2-dev libsqlite3-dev
Enter fullscreen mode Exit fullscreen mode

I usually start with a --dry-run option, check the size by removing the --dry-run, finally continue or rerun with a -y . In my case, I'm only missing bison libxml2-dev re2c which is less than 10 MB. For brevity, I will proceed with just a -y

sudo apt install -y pkg-config build-essential autoconf bison re2c libxml2-dev libsqlite3-dev
Enter fullscreen mode Exit fullscreen mode

I prefer having the git source code so I can backtrace and learn from changelogs. Check the latest version, in my case php-8.4.10

git clone git@github.com:php/php-src.git
git checkout php-8.4.10
./buildconf
Enter fullscreen mode Exit fullscreen mode

It's nice how PHP instructs the next step

./buildconf --force
./configure --enable-debug
Enter fullscreen mode Exit fullscreen mode

They'll reply with Thank you for using PHP.

make -j$(nproc)
Enter fullscreen mode Exit fullscreen mode

the reply:
Build complete.
Don't forget to run 'make test'.

make -j$(nproc) test 
Enter fullscreen mode Exit fullscreen mode

You may have found a problem in PHP.
This report can be saved and used to open an issue on the bug tracker at
https://github.com/php/php-src/issues
This gives us a better understanding of PHP's behavior.
Do you want to save this report in a file? [Yn]: Report saved to: /home/rkc/.php/php-src/php_test_results_20250723_2157.txt

So let's report a bug: https://github.com/php/php-src/issues/19227

It requires a php -v output

make install
sudo make install
php -v
Enter fullscreen mode Exit fullscreen mode

Finally, you'll see
PHP 8.4.10 (cli) (built: Jul 23 2025 14:34:18) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.4.10, Copyright (c) Zend Technologies

Disclaimer: I'm a Rails developer who is new to dev.to, and new to PHP. Exploring other languages.

Now, we go back to Laravel Installation

There is a note about installing Herd instead but only for Windows and MacOS.

We will proceed with Composer by installing via github.

You may also install via apt with

sudo apt install composer
Enter fullscreen mode Exit fullscreen mode

for latest: go to Official installation instructions

If you encounter
Warning: copy(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in Command line code on line 1
you may run php --ini

You may skip the Clone Composer section

Clone Composer

a dependency management for PHP [projects]

Create a fork

brave-browser https://github.com/composer/composer/fork
Enter fullscreen mode Exit fullscreen mode

Clone your own fork

cd your/preferred/path
git clone https://github.com/rkcperea/composer.git
Enter fullscreen mode Exit fullscreen mode

Although I enjoy debugging, I don't have the luxury of time. Let's proceed by following Laravel installs in Ubuntu step by step

Top comments (0)