So Following some previous existing subjects on the forum there were a lot of people asking how the hell do we get to install curl2 on php 8.3, follow this tutorial to rebuild the php 8.3 version with the default config from aapanel but with support for curl2
So first what we gonna do is go to App store and install php 8.3 so we gonna have it on app list as installed
After that we follow this tutorial
nghttp2 is a library that implements HTTP/2 (the second version of the HTTP protocol) and related tools.
wget http://node.aapanel.com/src/nghttp2-1.42.0.tar.gz
tar -zxf nghttp2-1.42.0.tar.gz
cd nghttp2-1.42.0
rm -rf /usr/local/nghttp2
autoreconf -i
automake
autoconf
./configure --prefix=/usr/local/nghttp2
make && make install
Next we gonna install curl with http2 support
This is for php 7.x version
wget http://node.aapanel.com/src/curl-7.74.0.tar.gz
tar -zxf curl-7.74.0.tar.gz
cd curl-7.74.0
mv /usr/local/curl /usr/local/curl_old
./configure --prefix=/usr/local/curl --with-nghttp2=/usr/local --with-ssl --enable-ares --without-nss --with-ssl=/usr/local/openssl --with-nghttp2=/usr/local/nghttp2
make && make install
On php 8.3 first check path if you have curl_2 folder in /usr/local
If you do not have it, use this is for php 8.3 ....
wget http://node.aapanel.com/src/curl-7.74.0.tar.gz
tar -zxf curl-7.74.0.tar.gz
cd curl-7.74.0
mv /usr/local/curl_2 /usr/local/curl_2_old
./configure --prefix=/usr/local/curl_2 --with-nghttp2=/usr/local --with-ssl --enable-ares --without-nss --with-ssl=/usr/local/openssl --with-nghttp2=/usr/local/nghttp2 --enable-http2
make && make install
Now so we can install support of php 8.3 with curl2 support we need to do the following
Install required dependencies:
sudo apt-get update
sudo apt-get install -y build-essential libxml2-dev libpng-dev libjpeg-dev libcurl4-openssl-dev libmcrypt-dev libfreetype6-dev libicu-dev libzip-dev pkg-config libssl-dev
Download the PHP 8.3 source code:
cd /usr/local/src
wget https://www.php.net/distributions/php-8.3.0.tar.bz2 # Adjust to the PHP 8.3 version
tar -xjf php-8.3.0.tar.bz2
cd php-8.3.0
Now, configure PHP to use the cURL with http2 support, installation from /usr/local/curl_2 and with the default aapanel php 8.3 default config :
./configure \
--prefix=/www/server/php/83 \
--with-config-file-path=/www/server/php/83/etc \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir \
--with-freetype \
--with-jpeg \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl=/usr/local/curl_2 \
--enable-mbregex \
--enable-mbstring \
--enable-intl \
--enable-ftp \
--enable-gd \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--with-gettext \
--disable-fileinfo \
--enable-opcache \
--with-sodium \
--with-webp \
PKG_CONFIG_PATH=:/www/server/php/83/lib64/pkgconfig:/www/server/php/83/share/pkgconfig
Compile PHP
Now that you have configured PHP, proceed with the compilation.
Use the following command to compile PHP using all available CPU cores:
make -j$(nproc)
Install the Newly Compiled PHP
Once the compilation finishes, install PHP 8.3 with the following command:
sudo make install
This will install PHP into the directory /www/server/php/83
To check curl2 support on your php version first you need to restart php 8.3 service from the panel
And after create this php file on your website testcurl.php
<?php
$curl_version = curl_version();
echo 'Curl version: ' . $curl_version['version'] . "\n";
echo 'Features: ' . $curl_version['features'] . "\n";
// Define the CURL_VERSION_HTTP2 constant if not already defined
if (!defined('CURL_VERSION_HTTP2')) {
define('CURL_VERSION_HTTP2', 1 << 16);
}
echo 'HTTP/2 support: ' . (($curl_version['features'] & CURL_VERSION_HTTP2) ? 'Yes' : 'No') . "\n";
#phpinfo();
?>
if everything went fine , you should see something like this when accesing the testcurl.php file
Curl version: 7.x.x Features: xxxxxxx HTTP/2 support: Yes
Next thing to do is go to the php 8.3 on your app list and install all your required extensions , have fun !