install php module in apache directadmin
cd /usr/local/directadmin/custombuild
./build used_configs | grep configure.php
PHP (default) configuration file: /usr/local/directadmin/custombuild/configure/php/configure.php56
phpMyAdmin configuration file: /usr/local/directadmin/custombuild/configure/phpmyadmin/config.inc.php
/usr/local/directadmin/custombuild/configure/php
check above location for custom PHP config with PHP versions
--enable-intl \
--with-apxs2 \
--with-mssql=/usr/local/freetds
cd /usr/local/directadmin/custombuild
./build php n
Check if MS Sql is intalled.
php -m|grep mssql mssql
If you're referring to the legacy MSSQL module (for connecting PHP to Microsoft SQL Server), note that the MSSQL extension for PHP was deprecated and removed in PHP 7+. The modern equivalent for Microsoft SQL Server is the sqlsrv extension, which is the recommended method for connecting to SQL Server from PHP.
sudo apt-get install unixodbc unixodbc-dev
yum install unixODBC-devel
cd /usr/local/directadmin/scripts/custom
wget https://raw.githubusercontent.com/poralix/directadmin-utils/master/php/php-extension.sh -O php-extension.sh
chmod 750 php-extension.sh
./php-extension.sh install sqlsrv
./php-extension.sh install pdo_sqlsrv
root@server-192-227-112-104:/usr/local/directadmin/scripts/custom# php -m | grep sqlsrvpdo_sqlsrvsqlsrv
Microsoft ODBC 18
if ! [[ "18.04 20.04 22.04 23.04 24.04" == *"$(lsb_release -rs)"* ]];then echo "Ubuntu $(lsb_release -rs) is not currently supported."; exit;fi
# Add the signature to trust the Microsoft repo# For Ubuntu versions < 24.04 curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc# For Ubuntu versions >= 24.04curl https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg
# Add repo to apt sourcescurl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
# Install the driversudo apt-get updatesudo ACCEPT_EULA=Y apt-get install -y msodbcsql18# optional: for bcp and sqlcmdsudo ACCEPT_EULA=Y apt-get install -y mssql-tools18echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrcsource ~/.bashrc# optional: for unixODBC development headerssudo apt-get install -y unixodbc-dev
"TrustServerCertificate"=>true
<?php$serverName = "192.227.81.203";$connectionInfo = array( "Database"=>"domainenquiries", "UID"=>"domainenquiries", "PWD"=>"MN2k9#@Dru", "TrustServerCertificate"=>true);$conn = sqlsrv_connect( $serverName, $connectionInfo);if( $conn ) { echo "Connection established.<br />";}else{ echo "Connection could not be established.<br />"; die( print_r( sqlsrv_errors(), true));}?>
Comments
Post a Comment