sudo su
add-apt-repository ppa:ondrej/php -y
apt-get update
apt-get install php8.3-dev php8.3-common php8.3-curl php-json php8.3-mbstring php8.3-mysql php8.3-xml php8.3-zip php8.3-imagick php8.3-gd -y --allow-unauthenticated
sudo update-alternatives --config php
sudo update-alternatives --config phar
sudo update-alternatives --config phar.phar
sudo update-alternatives --config phpize
-
Download the latest version of the driver from sqlsrv and pdo_sqlsrv
wget https://pecl.php.net/get/sqlsrv-5.11.1.tgz wget https://pecl.php.net/get/pdo_sqlsrv-5.11.1.tgz
-
Extract the files
tar -xvf sqlsrv-5.11.1.tgz tar -xvf pdo_sqlsrv-5.11.1.tgz
-
cd into the extracted each folder -Example:
cd sqlsrv-5.11.1 cd pdo_sqlsrv-5.11.1
-
Run
phpize
-
Run
./configure --with-php-config=/usr/bin/php-config8.3
Note: Make sure php 8.3 is installed. If not, run
sudo apt install php8.3-dev
-
Run
make
-
Run
sudo make install
-
Enable the extensions
sudo su printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/8.3/mods-available/sqlsrv.ini printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/8.3/mods-available/pdo_sqlsrv.ini exit
sudo phpenmod -v 8.3 sqlsrv pdo_sqlsrv
-
Enable apache2 mods
sudo apt install libapache2-mod-php8.3
sudo a2dismod php8.1 // disable php8.1 sudo a2enmod php8.3 // enable php8.3 a2dismod mpm_event a2enmod mpm_prefork
-
Restart apache2
sudo service apache2 restart