LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 01-24-2018, 04:22 PM   #1
ruggdr
LQ Newbie
 
Registered: Jan 2018
Posts: 3

Rep: Reputation: Disabled
CentOS 7, PHP 7.1, undefined function sqlsrv_connect()


Hello friends! I'm relatively new and still have a lot to learn about Linux in general. I've done a ton of research on this problem, and can't seem to find a clear-cut solution (other than advising to run on a Windows machine, which is not an option).

I have a php script that is trying to establish a connection to a database using sqlsrv_connect(). I am on CentOS 7, using PHP 7.1, with no luck. The exact issue I get when executing my php file in question is as follows:

PHP Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in /var/www/html/gocare/DBTest.php:8

After some online research, I looked up the location of mysqli.so and mysql.so and added the following to my php.ini configuration file.

extension=/usr/lib64/perl5/vendor_perl/auto/DBD/mysql/mysqli.so
extension=/usr/lib64/php/modules/mysql.so

Now I get the same error as before, but with a few extras when executing the DBTest.php. I've confirmed these files exist at these locations, and have no idea why I'm getting these errors. I've done "systemctl restart httpd" to restart httpd.

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/perl5/vendor_perl/auto/DBD/mysql/mysqli.so' - /usr/lib64/perl5/vendor_perl/auto/DBD/mysql/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysql.so' - /usr/lib64/php/modules/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in /var/www/html/gocare/DBTest.php:8
Stack trace:
#0 {main}
thrown in /var/www/html/gocare/DBTest.php on line 8


Any advice that can be given would be greatly appreciated, I think I might be in a little over my head here!
 
Old 01-25-2018, 02:13 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,168
Blog Entries: 1

Rep: Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038
Hi and welcome to LQ,
Quote:
I have a php script that is trying to establish a connection to a database using sqlsrv_connect(). I am on CentOS 7, using PHP 7.1, with no luck. The exact issue I get when executing my php file in question is as follows:

PHP Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in /var/www/html/gocare/DBTest.php:8

After some online research, I looked up the location of mysqli.so and mysql.so and added the following to my php.ini configuration file.

extension=/usr/lib64/perl5/vendor_perl/auto/DBD/mysql/mysqli.so
extension=/usr/lib64/php/modules/mysql.so
You didn't say how you've installed the driver?
Undo what you've done already and follow the instructions about RHEL7 and PHP-7.1 here.

Regards
 
Old 01-25-2018, 09:12 AM   #3
ruggdr
LQ Newbie
 
Registered: Jan 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank you, I will give that a try and update.
 
Old 01-25-2018, 11:31 AM   #4
ruggdr
LQ Newbie
 
Registered: Jan 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
I did what you asked and followed those directions, works like a charm now! Thank you very much!
 
Old 01-25-2018, 12:13 PM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,168
Blog Entries: 1

Rep: Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038
Quote:
Originally Posted by ruggdr View Post
I did what you asked and followed those directions, works like a charm now! Thank you very much!
Glad to see you've made it.
You may mark the thread as solved from the thread tools on top of the page.

Cheers
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Problem ('undefined index', 'undefined function') zokken Programming 2 12-04-2008 10:18 AM
undefined function scandir() in php tooparam Linux - Newbie 1 01-22-2006 01:03 AM
Need help with PHP and MySQL: Undefined function... Mega Man X Programming 12 09-15-2004 11:07 PM
Call to undefined function: mail() in PHP pembo13 Fedora 0 07-28-2004 07:40 PM
PHP: Call to undefined function: session_start() wellmt Linux - Newbie 2 06-01-2004 05:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 05:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration