ubuntu php pdo_sqlsev install fall but sqlsrv is successful - apache2

Does anyone successfully install pdo_sqlsrv in ubuntu php 7.2.9 environment? I only see sqlsrv on phpinfo(), pdo_sqlsrv always installed fail. Thank you very much.

I found an afternoon and finally found a solution.
The file 30-pdo_sqlsrv.ini in /etc/php/7.2/cli/conf.d ,
copy to /etc/php/7.2/apache2 , it work !!

curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get -y install msodbcsql17 mssql-tools
sudo apt-get -y install unixodbc-dev
sudo apt-get -y install gcc g++ make autoconf libc-dev pkg-config
sudo apt-get install php-pear php7.2-dev
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/7.2/mods-available/sqlsrv.ini
printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/7.2/mods-available/pdo_sqlsrv.ini
phpenmod -v 7.2 sqlsrv pdo_sqlsrv
a2enmod mpm_prefork
a2enmod php7.2
service apache2 restart

Related

Problem with apt-key in Microsoft ODBC driver installation for Ubuntu?

These commands are pulled from this site: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver16#ubuntu18
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo apt-get install -y unixodbc-dev
These are Microsoft's official steps to install ODBC drivers on Ubuntu. I am not too familiar with Linux, so I do not know if using the deprecated apt-key commands will cause me any issues in the future. Could someone let me know if this is a reasonable concern? And if it is, what is the best practice to make my environment more stable for the future?
Thanks

Docker timeout error mssql17 connection on M1 arm64 architecture

Could you please help me resolve this issue:
I must to say that everything is working fine on Windows amd64 architecture
But when I tried to start docker-compose on arm64 M1 it went wrong and makes the error
So I have these 2 Dockerfiles
FROM --platform=linux/amd64 python:3.9-buster as builder
WORKDIR ...
COPY ...
RUN apt-get update && apt-get install -y git g++ libgirepository1.0-dev unixodbc unixodbc-dev pkg-config libcairo2-dev gcc python3-dev
RUN pip install virtualenv &&\
python -m venv antenv
RUN . antenv/bin/activate &&\
python -m ensurepip --upgrade &&\
pip install --upgrade pip &&\
pip install wheel gobject PyGObject &&\
pip install -r requirements.txt
FROM --platform=linux/amd64 python:3.9-slim
WORKDIR ...
COPY --from=builder ...
RUN apt-get update && apt-get install curl gnupg -y
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - &&\
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list &&\
apt-get update &&\
ACCEPT_EULA=Y apt-get install msodbcsql17 mssql-tools -y &&\
apt-get install -y unixodbc python3-gi gir1.2-secret-1 alembic &&\
. antenv/bin/activate && pip install gunicorn &&\
mkdir -p /opt/antenv/nltk_data
EXPOSE 5000
CMD . antenv/bin/activate && alembic -x data=true upgrade head && gunicorn wsgi:app -w 1 --worker-class eventlet --threads 2 --forwarded-allow-ips=* -b 0.0.0.0:5000
and DataBase:
FROM --platform=linux/amd64 mcr.microsoft.com/mssql/server:2017-latest
WORKDIR /opt/mssql/
# Bundle config source
COPY ./*.sh /opt/mssql/bin/
RUN chmod +x /opt/mssql/bin/*.sh
ENTRYPOINT ["./bin/entrypoint.sh"]
CMD ["tail -f /dev/null"]
As you can see I mentioned everywhere that it is linux/amd64 platform
DataBase is upping good and I don`t get eerors
But when I up Backend, It as if does not see database and I get timeout error
backend | sqlalchemy.exc.OperationalError: (pyodbc.OperationalError) ('HYT00', '[HYT00] [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')
backend | (Background on this error at: https://sqlalche.me/e/14/e3q8)

How to install old versions of Xdebug

Actually, with the new release of Xdebug 3, I have to investigate more why its not working. I don't have much time for that.
The problem was I had this command for vagrant box creation but it does not have any version number.
sudo apt-get install -y php-xdebug
Is there a way to specify the version number to install version 2.9.3
this worked for me. Thank you #LazyOne for help. :-)
sudo apt-get install -y php-pear php7.3-dev
sudo apt install -y php7.3-xdebug
sudo pecl install xdebug-2.9.3

error processing package linux-image-4.15.0-20-generic

when i want to update or install any package i got this error:
for example : whealln i exec this sudo apt upgrade or sudo apt install zsh
dpkg: error processing package linux-image-4.15.0-20-generic (--remove):
installed linux-image-4.15.0-20-generic package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-20-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
how to fix it?
These commands should hopefully work. They will do a full clean and reinstall.
sudo apt-get autoremove
sudo apt-get --purge remove && sudo apt-get autoclean
sudo apt-get -f install
sudo apt-get update
sudo apt-get upgrade && sudo apt-get dist-upgrade
sudo dpkg-reconfigure -a
sudo dpkg --configure -a

How to uninstall Nagios and NRPE

Can you tell me how can i uninstall nagios and NRPE.
I have tried this command to uninstall NRPE:
sudo apt-get remove nagios-nrpe-server
but when I execute this command it's display to me the version of Nrpe installed
./check_nrpe -H localhost
Thank you in advance
Follow these steps in given order.
1. sudo apt-get remove nagios-nrpe-server
2. sudo apt-get remove --auto-remove nagios-nrpe-server
3. sudo apt-get purge nagios-nrpe-server
4. sudo apt-get purge --auto-remove nagios-nrpe-server
Reboot your machine ,hope this solves your issue.
Simply remove all the nagios packages by:
sudo apt-get remove nagios*

Resources