Last active
February 6, 2025 14:15
-
-
Save programmerShinobi/7d1c77c3fc616c09c700e4b416bfdcc4 to your computer and use it in GitHub Desktop.
Setup PHP 7.2 with sqlsrv & pdo_sqlsrv on Linux (Ubuntu 22.04)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
faqih@shinobi:~$ sudo apt-get update | |
faqih@shinobi:~$ sudo apt-get upgrade | |
faqih@shinobi:~$ sudo service packagekit restart | |
faqih@shinobi:~$ sudo apt-get update --fix-missing | |
faqih@shinobi:~$ sudo apt install software-properties-common | |
faqih@shinobi:~$ sudo add-apt-repository ppa:ondrej/php | |
faqih@shinobi:~$ sudo apt update | |
faqih@shinobi:~$ sudo dpkg --configure -a | |
faqih@shinobi:~$ sudo apt --fix-broken install | |
faqih@shinobi:~$ sudo apt update | |
faqih@shinobi:~$ sudo apt-get install php7.2 php7.2-fpm | |
faqih@shinobi:~$ sudo apt-get install php7.2-mysql php7.2-mbstring php7.2-xml php7.2-gd php7.2-curl | |
faqih@shinobi:~$ php -v | |
SHOW (install success) : | |
PHP 7.2.34-43+ubuntu22.04.1+deb.sury.org+1 (cli) (built: Sep 2 2023 08:01:34) ( NTS ) | |
Copyright (c) 1997-2018 The PHP Group | |
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies | |
with Zend OPcache v7.2.34-43+ubuntu22.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies | |
faqih@shinobi:~$ sudo apt-get update | |
faqih@shinobi:~$ sudo apt-get -y --no-install-recommends install apt-utils libxml2-dev gnupg apt-transport-https | |
faqih@shinobi:~$ sudo apt-get clean | |
faqih@shinobi:~$ sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* | |
faqih@shinobi:~$ sudo apt-get clean | |
faqih@shinobi:~$ sudo apt update | |
faqih@shinobi:~$ sudo apt install asc | |
faqih@shinobi:~$ sudo service packagekit restart | |
faqih@shinobi:~$ sudo apt-get update --fix-missing | |
faqih@shinobi:~$ sudo apt install php7.2-dev | |
faqih@shinobi:~$ sudo apt-get install libtool | |
faqih@shinobi:~$ curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg | |
faqih@shinobi:~$ sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg | |
faqih@shinobi:~$ sudo apt-get update | |
faqih@shinobi:~$ ACCEPT_EULA=Y sudo apt-get -y --no-install-recommends install msodbcsql17 | |
faqih@shinobi:~$ wget https://pecl.php.net/get/sqlsrv-5.8.1.tgz | |
faqih@shinobi:~$ tar -zxvf sqlsrv-5.8.1.tgz | |
faqih@shinobi:~$ cd sqlsrv-5.8.1 | |
faqih@shinobi:~/sqlsrv-5.8.1$ make clean | |
faqih@shinobi:~/sqlsrv-5.8.1$ phpize | |
faqih@shinobi:~/sqlsrv-5.8.1$ ./configure | |
faqih@shinobi:~/sqlsrv-5.8.1$ make | |
faqih@shinobi:~/sqlsrv-5.8.1$ sudo make install | |
faqih@shinobi:~/sqlsrv-5.8.1$ sudo sh -c 'echo "extension=sqlsrv.so" >> $(php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||")/30-sqlsrv.ini' | |
faqih@shinobi:~/sqlsrv-5.8.1$ php -m | |
faqih@shinobi:~/sqlsrv-5.8.1$ cd ../ | |
faqih@shinobi:~$ wget https://pecl.php.net/get/pdo_sqlsrv-5.8.1.tgz | |
faqih@shinobi:~$ tar -zxvf pdo_sqlsrv-5.8.1.tgz | |
faqih@shinobi:~$ cd pdo_sqlsrv-5.8.1 | |
faqih@shinobi:~/pdo_sqlsrv-5.8.1$ phpize | |
faqih@shinobi:~/pdo_sqlsrv-5.8.1$ ./configure | |
faqih@shinobi:~/pdo_sqlsrv-5.8.1$ make | |
faqih@shinobi:~/pdo_sqlsrv-5.8.1$ sudo make install | |
faqih@shinobi:~/pdo_sqlsrv-5.8.1$ sudo sh -c 'echo "extension=pdo_sqlsrv.so" >> $(php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||")/30-pdo_sqlsrv.ini' | |
faqih@shinobi:~/pdo_sqlsrv-5.8.1$ php -m | |
faqih@shinobi:~/pdo_sqlsrv-5.8.1$ cd ../ | |
faqih@shinobi:~$ php -S localhost:8080 | |
SHOW (install success) : | |
PHP 7.2.34-43+ubuntu22.04.1+deb.sury.org+1 Development Server started at Mon Nov 13 02:24:00 2023 | |
Listening on http://localhost:8080 | |
Document root is /home | |
Press Ctrl-C to quit. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment