msphpsql: Undefined function sqlsrv_connect() - Ubuntu 16.04
Hello,
I have problem with installing sqlsrv. I am using Ubuntu 16,04 and PHP v. 7.0. I went through the installation as you describing without problem, but with your test php file I am getting this error:
Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in /var/www/html/web/testsql.php:17 Stack trace: #0 {main} thrown in /var/www/html/web/testsql.php on line 17
The only difference that I found is, that although I am using PHP 7.0 .so files are in 20160303 folder - I changed the lines in php.ini files, but it still doesnt work.
Could you please help me with this problem? Both php.ini are attached.
Thank you
D. Stanek
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 44 (9 by maintainers)
The set up guide needs updating. I managed to get it working on CLI and apache by adding the following lines:
extension=sqlsrv.soto
/etc/php/7.0/cli/php.ini
and
/etc/php/7.0/apache2/php.ini
Thank a lot. It helped me as well
arrrr! @yitam thanks. Sorry for the stupid question!
Hello guys, pretty rich conversation here, I tried updated readme, then added extension=sqlsrv.so to both ini files and now it works! Thanks for your effort!
@meet-bhagdev Yes, that’s how I solved it. I set up a fresh Ubuntu VirtualBox/Vagrant installation and was trying to solve this issue. Adding the extension in the format mentioned fixed it for my installation, and it seems to be working great now. I am actually NOT the OP, but I was having the same issue so I figured I’d post how I fixed it. FWIW I installed every php extension I could find.
@stanedav I went through the log you sent and did the exact steps, but I was unable to get apache run php7.0 and commandline use php 7.1, assuming that php 7.1 is what we want to run on apache, let’s clean up php7.0 dependencies that might be installed from php 7.0 installation
this is output of edited .php file, you will find it in attachment. testsql.txt
Yes, I have multiple installations, because before I found this GitHub I found many guides how to install sqlsrv and it needed php 5.6… If I list my /etc/php there are three folders: 5.6 7.0 7.1,…
I am wondering, I dont have any data on my server, and I already set up SSH, maybe I can send you credentials via PM?