Hi,
I don't do this often but ... I've been waiting since Fedora 17 to use the new sqlsrv with php. And still cannot install it on on a fedora box. Here are the details of what I've read and tried.
+## PHP Driver version or file name
+## SQL Server version
+## Client operating system
+## PHP version
+## Microsoft ODBC Driver version
+## Problem description
+## Expected behavior and actual behavior
+## Repro code or steps to reproduce
Copy default Fedora Server 29 install to another VM. Pick another random guide that I have to pick and guess my way through to get the commands to work on fedora. Get frustrated at the circular BS, wait another year to see if it anything actually works yet. Ponder if everyone is using ubuntu because that's the only system that works with this stuff nowadays. Is fedora dead? Is that the reason? Should I stop using fedora?
Also, to note, the internet is covered in people having issues about getting php and sqlsrv installed and talking to an ms sql server. And it's because between you and microsoft, I believe you guys just don't want anyone using each others software. So you're making it like this on purpose. Post a bunch of guides, pretend to look like it should work. But in the end, if you follow it through all the way, it doesn't work.
@Grglrglrg It would help if you describe exactly what you did and what the resulting error message was. If you're looking for a simple way to install the sqlsrv driver, you can try a packaged version of sqlsrv for Fedora available from the Remi repo but bear in mind that 1. We do not control that build, and 2. Fedora is not officially supported (but Red Hat Enterprise Linux and CentOS are supported).
I've figured it out this morning. Probably my 8th try in the last 5 years.
Suppose I could post my answer here ..I'm not sure this is the right place for this. Just needed a shoulder to cry on for a bit, thought maybe you'd have an unofficial guide. PHP 5 is pretty old now and it's hard to upgrade when the php extension (that's been out for..quite some time) isn't officially supported for the distro we use and nobody can say how to install it in a simple short list without linking 5 web pages to go to (ms, github and 2 or so pages on each side with 10 page guides on each webpage) with guides and examples that don't work for fedora.
Suppose it was the mssqlodbc* that kept tripping me up along with all the yum usage and non-fedora commands mixed with random repo listings and repo errors when finally added. It just seemed like a mess and I kept waiting for someone to straighten it out and nobody has yet. At least I figured out how to do it on fc29.
Anyway, Your "fedora isn't supported officially" and what you said helped me try a littler harder and give up hope on the guides. So here's how to do it on fc29-server. If there's a place for this anywhere..otherwise I'm not sure I care enough to come back to this aside from keeping this somewhere.
dnf install php php-devel php-pdo unixODBC-devel make php-pear
#chose rehl rpm because I think fc is very similar to rhel, but I have no idea why it worked.
wget https://packages.microsoft.com/rhel/7/prod/msodbcsql17-17.2.0.1-1.x86_64.rpm
dnf install msodbcsql17-17.2.0.1-1.x86_64.rpm
wget https://packages.microsoft.com/rhel/7/prod/mssql-tools-17.2.0.2-1.x86_64.rpm
dnf install mssql-tools-17.2.0.2-1.x86_64.rpm
pecl install sqlsrv
pecl install pdo_sqlsrv
echo "extension=pdo_sqlsrv.so" > /etc/php.d/20-sqlsrv.ini
echo "extension=sqlsrv.so" > /etc/php.d/20-pdo_sqlsrv.ini
setsebool -P httpd_can_network_connect_db 1
And then your php samples will work. Anyway...back to work. Feel free to close/delete this whole thing or do whatever with this. I'm sure this solution probably works with fedora-server 25-29 and maybe more. Of course you guys just refer to microsofts website now for the guides so.. guess that's that. Cya.
Thank you or sharing your experience. Glad you figured out how to make it work, others will surely benefit from what you did.
Most helpful comment
I've figured it out this morning. Probably my 8th try in the last 5 years.
Suppose I could post my answer here ..I'm not sure this is the right place for this. Just needed a shoulder to cry on for a bit, thought maybe you'd have an unofficial guide. PHP 5 is pretty old now and it's hard to upgrade when the php extension (that's been out for..quite some time) isn't officially supported for the distro we use and nobody can say how to install it in a simple short list without linking 5 web pages to go to (ms, github and 2 or so pages on each side with 10 page guides on each webpage) with guides and examples that don't work for fedora.
Suppose it was the mssqlodbc* that kept tripping me up along with all the yum usage and non-fedora commands mixed with random repo listings and repo errors when finally added. It just seemed like a mess and I kept waiting for someone to straighten it out and nobody has yet. At least I figured out how to do it on fc29.
Anyway, Your "fedora isn't supported officially" and what you said helped me try a littler harder and give up hope on the guides. So here's how to do it on fc29-server. If there's a place for this anywhere..otherwise I'm not sure I care enough to come back to this aside from keeping this somewhere.
Do a default fc29-server install - then do this
dnf install php php-devel php-pdo unixODBC-devel make php-pear
#chose rehl rpm because I think fc is very similar to rhel, but I have no idea why it worked.
wget https://packages.microsoft.com/rhel/7/prod/msodbcsql17-17.2.0.1-1.x86_64.rpm
dnf install msodbcsql17-17.2.0.1-1.x86_64.rpm
wget https://packages.microsoft.com/rhel/7/prod/mssql-tools-17.2.0.2-1.x86_64.rpm
dnf install mssql-tools-17.2.0.2-1.x86_64.rpm
pecl required make and sql.h from unixodbc-devel
pecl install sqlsrv
pecl install pdo_sqlsrv
And the default attempt in all the guides to concat to the bottom of /etc/php.ini doesn't work for some reason. Had to move to php.d ini directory with the rest of them.
echo "extension=pdo_sqlsrv.so" > /etc/php.d/20-sqlsrv.ini
echo "extension=sqlsrv.so" > /etc/php.d/20-pdo_sqlsrv.ini
for selinux
setsebool -P httpd_can_network_connect_db 1
And then your php samples will work. Anyway...back to work. Feel free to close/delete this whole thing or do whatever with this. I'm sure this solution probably works with fedora-server 25-29 and maybe more. Of course you guys just refer to microsofts website now for the guides so.. guess that's that. Cya.