Step‑by‑Step Guide to Installing PHP 8.4, Composer, Webman and ThinkPHP on Linux

This tutorial walks you through downloading PHP 8.4, installing required libraries, compiling and installing the interpreter, configuring php.ini and PHP‑FPM, setting up a systemd service, then adding Composer, Webman and ThinkPHP frameworks, and finally configuring Nginx to serve the applications.

Open Source Tech Hub
Open Source Tech Hub
Open Source Tech Hub
Step‑by‑Step Guide to Installing PHP 8.4, Composer, Webman and ThinkPHP on Linux

Install PHP 8.4

PHP 8.4 (release 8.4.1) adds property hooks, asymmetric visibility, an updated DOM API, performance improvements and numerous bug fixes.

Download source

wget https://www.php.net/distributions/php-8.4.1.tar.gz
tar -zxvf php-8.4.1.tar.gz

Install build dependencies (Debian/Ubuntu)

sudo apt-get install libfcgi-dev libfcgi0ldbl libjpeg-turbo8-dev \
    libmcrypt-dev libssl-dev libc-client2007e libxml2-dev libbz2-dev \
    libcurl4-openssl-dev libjpeg-dev libpng-dev libfreetype6-dev \
    libkrb5-dev libpq-dev libxslt1-dev libzip-dev libsqlite3-dev \
    libonig-dev pkg-config libreadline-dev
If a package is missing, locate it with apt-cache search <name> and install the appropriate package.

Configure and compile

cd php-8.4.1
sudo ./configure \
    --prefix=/usr/local/php-8.4.1 \
    --with-config-file-path=/usr/local/php-8.4.1/etc \
    --with-freetype \
    --enable-mbstring \
    --enable-soap \
    --enable-calendar \
    --with-curl \
    --with-zlib \
    --enable-gd \
    --disable-rpath \
    --with-bz2 \
    --enable-sockets \
    --enable-sysvsem \
    --enable-sysvshm \
    --enable-pcntl \
    --enable-mbregex \
    --enable-exif \
    --enable-bcmath \
    --with-mhash \
    --with-zip \
    --with-pdo-mysql \
    --with-mysqli \
    --with-mysql-sock=/var/run/mysqld/mysqld.sock \
    --with-jpeg \
    --with-openssl \
    --with-fpm-user=www \
    --with-fpm-group=www \
    --with-libdir=/lib/x86_64-linux-gnu \
    --enable-ftp \
    --with-gettext \
    --with-xsl \
    --enable-opcache \
    --enable-intl \
    --with-pear \
    --enable-fpm

Build and install

make
sudo make install

The installation places the CLI binary, PHP‑FPM binaries, shared extensions, man pages and the PEAR environment under /usr/local/php-8.4.1.

Verify installation

/usr/local/php-8.4.1/bin/php -v

Expected output includes PHP 8.4.1 (cli) and Zend Engine v4.4.1.

Configure php.ini

sudo cp php.ini-production /usr/local/php-8.4.1/etc/php.ini
Note: Set cgi.fix_pathinfo=0 to prevent Nginx from exposing arbitrary scripts.

Configure PHP‑FPM

Copy default configuration files and adjust user/group and socket settings:

cd /usr/local/php-8.4.1/etc
cp php-fpm.conf.default php-fpm.conf
cp php-fpm.d/www.conf.default php-fpm.d/www.conf

# Edit www.conf
user = www
group = www
listen.owner = www
listen.group = www
listen.mode = 0660
# Use a Unix socket instead of a TCP port
listen = /var/run/php8.4.1-fpm.sock

Create a systemd unit for PHP‑FPM

sudo vim /lib/systemd/system/php-8.4.1-fpm.service

File content:

[Unit]
Description=PHP 8.4.1 FastCGI Process Manager
After=network.target

[Service]
Type=simple
PIDFile=/usr/local/php-8.4.1/var/run/php-fpm.pid
ExecStart=/usr/local/php-8.4.1/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php-8.4.1/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target

Enable and start the service:

sudo systemctl enable php-8.4.1-fpm.service
sudo systemctl daemon-reload
sudo systemctl start php-8.4.1-fpm.service
sudo systemctl status php-8.4.1-fpm.service

Install Composer

wget https://getcomposer.org/download/latest-stable/composer.phar

Verify:

/usr/local/php-8.4.1/bin/php composer.phar -V

Install Webman 1.6

Create a new Webman project using the freshly installed Composer:

/usr/local/php-8.4.1/bin/php composer.phar create-project workerman/webman webman1.6

Start the server: /usr/local/php-8.4.1/bin/php start.php start The console lists workers and shows the listening address (e.g., 0.0.0.0:8289).

Install ThinkPHP 8.1

Because multiple PHP versions may coexist, invoke Composer with the absolute PHP binary path:

/usr/local/php-8.4.1/bin/php composer.phar create-project topthink/think tp8.1

Nginx host configuration for ThinkPHP

server {
    listen 80;
    server_name 121.128.128.128;
    set $root_path /home/www/build/tp8.1/public;
    root $root_path;

    location / {
        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php?s=/$1 last;
            break;
        }
    }

    location ~ \.php$ {
        try_files $fastcgi_script_name =404;
        include fastcgi_params;
        fastcgi_pass unix:/var/run/php8.4.1-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 4 256k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_connect_timeout 10000;
        fastcgi_send_timeout 6000;
        fastcgi_read_timeout 6000;
    }
}

Reload Nginx and visit http://121.128.128.128 to see the ThinkPHP welcome page.

Access URLs

Webman: http://0.0.0.0:8289 (as shown by the start script).

ThinkPHP: the IP address configured in the Nginx server block.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

linuxPHPInstallationComposerThinkPHPWebman
Open Source Tech Hub
Written by

Open Source Tech Hub

Sharing cutting-edge internet technologies and practical AI resources.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.