-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR 404: Not Found with installodbc_redhat.sh #298
Comments
Hi @mikelecours msodbcsql-13.0.0.0.tar.gz is old. Please follow the instructions on readme To verify that ODBC driver is registered successfully, do the following: You should see an output like this
Hope this helps. |
That's the output I got. Thanks. I then followed the README instructions. Everything seemed to install OK. But when I tried the test php script in the readme I got the error: I've attached the testsql.php file for your review Just to be sure, I tried the connection string in sqlcmd and it worked just fine [root@nagios ~]# sqlcmd -S 10.21.50.131 -d nagiosdb -U nagios -P
|
This is odd, so to help us investigate, please add these lines after calling
|
Here's the new error messages |
@mikelecours Code 10013 means "Permission Denied". It might be firewall or related issues. In addition, you ran Please try the followings:
Also, what version of SQL Server are you using? On which Windows version? #190 might be a related issue. |
I've confirmed I can connect as a regular user:
|
Thanks @mikelecours for the details. What output do you get when running Also, to help us troubleshoot the connection issues, please go through the section For example, when you run |
Here's the result of the driver query [nagios@nagios ~]$ odbcinst -q -d -n "ODBC Driver 13 for SQL Server" Here's the result of the yum list command Installed Packages I'll try working through the trouble shooting document and report back the results |
I ran through the troubleshooting steps. The results are attached below. If I'm interpreting them correctly, the most common issue of more than one driver manager installed is false. It seems that the odbc drives themselves are working correctly. It seems that php is just not talking to them. I don't know if this helps, but what I'm try to do is monitor a SQL Server instance with Nagios. It uses php to connect. Here's the error message I get from Nagios. It has different error messages that might help. |
@mikelecours your new error messages definitely gave us a clue. Please do the followings:
Then edit this php.ini file and look for
Meanwhile I'll take a look at your attached logs. |
Interesting. The php --ini showed me the ini file that was loaded /etc/php.ini . The two extension statement were in there. I put them in per the install instructions. There were no duplicates. I looked up the PHP Warning: Module 'sqlsrv' already loaded in Unknown on line 0 part of the error and found a site that said to take out the extension statements if sqlsrv and pdo_sqlsrv were listed in the php -m statement because they are already compiled. http://www.somacon.com/p520.php So, I rem'd them out to see what would happen. Now my app just returns UNKNOWN: MSSQL/DBLIB support is not installed on this server. pdo_dblib must be usable. The other part of the error is gone. No change with the testsql.php. Still the same errors. Attached are the lists from php -m and php --ini before the rem out. They both showed the Unknown line 0 error. That went away after I rem'd out the extension statement. So php 7 doesn't like those statements. We changed the error message. That's progress, right? |
First of all, @mikelecours you're right, that for CentOS we shouldn't have the extensions in php.ini file. Instead, please read Step 5 of readme and you will find that RedHat / CentOS is handled differently from others. The main reason is that we have to ensure the extension PDO is loaded first. Now that the lines have been commented out, you don't get those warning messages again, correct? When you run
What do you get when you run Lastly, mssql pdo_dblib is a different extension. |
Yeah, I'm not sure why Nagios is complaining about that. But I mention it just to show the other error message is gone. I verified that php -m shows both sqlsrv and pdo_sqlsrv. I review step 5 of the readme and verified the entries in their ini files: [nagios@nagios ~]$ grep sqlsrv.so /etc/php.d/sqlsrv.ini Here is the results of the php --ri sqlsrv sqlsrv sqlsrv support => enabled Directive => Local Value => Master Value Everything seems to say the drivers are OK, sqlcmd can use them, why can't php? |
Good question @mikelecours :) I believe it's something to do with your environment, so let's take a couple of steps back and run odbc trace again. Previously, you said your testsql.php did not write anything to the log. Is it still the case? Do you have a clean CentOS vm for testing purposes? Also, I wonder why it complains about pdo_dblib. Please check if the extension is listed in your php.ini |
You're not going to believe this but I found the problem. It's SELinux. I set it to permissive to test another problem and suddenly the testphp page works - connect to my database just fine. Set it SELinux back to enforcing - doesn't work. Back to permissive, works great. Since I can't leave it in permissive, any guidance on what needs to be set to allow php to keep using the drivers? |
Glad to hear that you found a solution to this, @mikelecours. However, SELinux seems to have troubles with Apache + PHP (see this page for example). Just for a quick test, can you run a simple script like this:
|
Yes, it returns the versioning information. I'll look at the page you sent me to see if I can solve the SELinux problem |
Just so you know, we've confirmed that once SELinux is set to Enforcing, the php script won't run on Apache (even though running the same script from a terminal |
Thanks for all your help and prompt attention . It was very much appreciated. |
Hi @mikelecours , Can you post output of the following command?
|
If
|
That did the trick! Thanks! |
We are glad to hear that the suggestion from @ulvii works, @mikelecours ! |
For this application, httpd_can_network_connect_db is preferred. According to the man page for httpd_selinux, httpd_can_network_connect_db only allow connection to known database ports where as httpd_can_network_connect allow connect to any port. Below is the allowed ports from the man page for connect_db allow httpd_t postgresql_port_t : tcp_socket { recv_msg send_msg name_connect } ; |
Thank you for your contributions, @mikelecours . We will update our documentation accordingly. |
When attempting to install the msphsql drivers, the install script for red hat fails with a 404 error when trying to download msodbcsql-13.0.0.0.tar.gz. Below is the log of the install. Is there another location wher I can get the file?
--2017-02-22 09:17:08-- ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.1.tar.gz
=> \u2018/tmp/msodbcrhel/unixODBC-2.3.1.tar.gz\u2019
Resolving ftp.unixodbc.org (ftp.unixodbc.org)... 87.106.19.214
Connecting to ftp.unixodbc.org (ftp.unixodbc.org)|87.106.19.214|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /pub/unixODBC ... done.
==> SIZE unixODBC-2.3.1.tar.gz ... 1813380
==> PASV ... done. ==> RETR unixODBC-2.3.1.tar.gz ... done.
Length: 1813380 (1.7M) (unauthoritative)
100%[====================================================================================================>] 1,813,380 264KB/s in 8.9s
2017-02-22 09:17:24 (198 KB/s) - \u2018/tmp/msodbcrhel/unixODBC-2.3.1.tar.gz\u2019 saved [1813380]
Loaded plugins: fastestmirror, langpacks
Repository packages-microsoft-com-prod is listed more than once in the configuration
base | 3.6 kB 00:00:00
epel/x86_64/metalink | 14 kB 00:00:00
extras | 3.4 kB 00:00:00
google-chrome | 951 B 00:00:00
packages-microsoft-com-prod | 2.9 kB 00:00:00
remi-safe | 2.9 kB 00:00:00
updates | 3.4 kB 00:00:00
webtatic | 3.6 kB 00:00:00
(1/2): updates/7/x86_64/primary_db | 2.3 MB 00:00:00
(2/2): remi-safe/primary_db | 907 kB 00:00:01
Loading mirror speeds from cached hostfile
Package gcc-4.8.5-11.el7.x86_64 already installed and latest version
Nothing to do
Succesfuly installed Yum Dependencies
Installing unixODBC 2.3.1
Successfuly installed unixODBC 2.3.1
--2017-02-22 09:18:22-- https://download.microsoft.com/download/B/C/D/BCDD264C-7517-4B7D-8159-C99FC5535680/msodbcsql-13.0.0.0.tar.gz
Resolving download.microsoft.com (download.microsoft.com)... 173.222.6.110, 2600:1417:4:187::e59, 2600:1417:4:196::e59
Connecting to download.microsoft.com (download.microsoft.com)|173.222.6.110|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-02-22 09:18:24 ERROR 404: Not Found.
Unable to get Microsfot ODBC Driver from download center.
sudo: unable to resolve current working directory
The text was updated successfully, but these errors were encountered: