Conectar PHP con SQL Server desde CentOS 6.5

Este mes tuve un nuevo requerimiento de un cliente. Tenemos lo siguiente: • 01 pc con windows 7 y sql server 2012 • 01 servidor Centos con Apache y PHP5.4 Necesitamos obtener una lista de pacientes de la base de datos en sqlserver y mostrarla en una aplicación web que esta alojado en Centos.

Buscando en san google, links por aquí, por allá y luego de varios quebraderos de cabeza la solución se resume en un post muy bueno que encontré:

http://scriptinside.blogspot.com.es/2013/04/error-unable-to-connect-to-server.html

Instalar en este orden:

> yum update
> yum groupinstall Development Tools
> yum install httpd
> yum install freetds
> yum install freetds-devel
> yum install php php-devel php-mssql
> service httpd restart
> php -m (verifico que módulos tiene instalado el php, alli debe figurar php-mssql)
> vi /etc/freetds.conf

añadimos una conexión personalizada

#mi conexion sqlserver
[sqlserver2012]
host = IP de destino
port = 1433
tds version = 8.0

grabamos y salimos. probamos la conexión

> tsql -S sqlserver2012 -p 1433 -U sa

si hay problemas como este:

Error 20009 (severity 9): Unable to connect: Adaptive Server is unavailable or does not exist OS error 110, Connection timed out

Este es el error típico de que el firewall del servidor SQL no está permitiendo las conexiones entrantes.

Error 20009 (severity 9): Unable to connect: Adaptive Server is unavailable or does not exist OS error 111, Connection refused

Este error significa que te estas conectando mal al servidor SQL, por ejemplo puedes estar conectandote por IP (tsql -H) con los datos por defecto en vez de conectarte utilizando tsql –S.

tener en cuenta que este deshabilitado el firewall de windows, si todo va bien creamos el php de prueba

<?php

$msconnect=mssql_connect("sqlserver2012","sa","clave");
$msdb=mssql_select_db("nombrebd",$msconnect);
$msquery = "select titleofcourtesy,firstname,lastname from employees";
$msresults= mssql_query($msquery);
while ($row = mssql_fetch_array($msresults)) {
echo $row['titleofcourtesy'];
}

?>

sqlserver2012: es el nombre de la conexión en freetds.conf

Comentarios

1. El Jueves, Abril 19 2018, 17:36 por pnc speedpay

Hi, Neat post. There's an issue with your web site in web explorer,
would check this? IE nonetheless is the market
chief and a good section of other folks will leave out
your excellent writing because of this problem.

2. El Lunes, Agosto 27 2018, 09:54 por look at here

Excellent beat ! I would like to apprentice while you
amend your website, how could i subscribe for a blog website?
The account aided me a acceptable deal. I had been a little bit acquainted of this your
broadcast provided bright clear idea

3. El Miércoles, Septiembre 12 2018, 06:32 por vb centella

Attractive section of content. I just stumbled upon your website
and in accession capital to assert that I acquire in fact enjoyed account your blog posts.
Any way I will be subscribing to your augment and even I achievement you access consistently fast.

4. El Sábado, Septiembre 22 2018, 18:16 por vitabrain

Very great post. I simply stumbled upon your weblog and
wanted to mention that I've really enjoyed surfing around your
blog posts. In any case I will be subscribing for your rss feed and I'm hoping you write
again soon!

5. El Jueves, Octubre 4 2018, 11:57 por minecraft

Thanks for a marvelous posting! I seriously enjoyed reading it, you could be a
great author. I will remember to bookmark your blog and may come
back from now on. I want to encourage you continue your great
writing, have a nice afternoon!

6. El Jueves, Octubre 4 2018, 19:35 por minecraft

Outstanding post but I was wanting to know if you could
write a litte more on this topic? I'd be very grateful if you could elaborate a little bit more.
Cheers!

7. El Jueves, Octubre 4 2018, 23:21 por minecraft

This information is invaluable. Where can I find out more?

8. El Viernes, Octubre 5 2018, 14:32 por minecraft

I am not sure where you're getting your info, but good topic.

I needs to spend some time learning more or understanding more.
Thanks for fantastic info I was looking for this information for my mission.

9. El Viernes, Octubre 5 2018, 22:59 por minecraft

Hey I know this is off topic but I was wondering if you knew of any
widgets I could add to my blog that automatically tweet my newest twitter updates.
I've been looking for a plug-in like this for quite some time
and was hoping maybe you would have some experience with
something like this. Please let me know if you run into anything.
I truly enjoy reading your blog and I look forward
to your new updates.

10. El Sábado, Octubre 6 2018, 09:13 por minecraft

Hi, I do believe this is a great site. I stumbledupon it
;) I may come back once again since i have bookmarked it.
Money and freedom is the best way to change, may you be rich and continue to help other people.

11. El Sábado, Octubre 6 2018, 11:31 por minecraft

Great post.

12. El Domingo, Octubre 7 2018, 07:34 por minecraft

For latest news you have to visit the web and on web I found this web
site as a finest web site for most recent updates.

13. El Domingo, Octubre 7 2018, 08:37 por minecraft

Hey there! This is my first comment here so I just wanted to give
a quick shout out and say I really enjoy reading your blog posts.
Can you recommend any other blogs/websites/forums
that cover the same topics? Thanks a lot!

14. El Domingo, Octubre 7 2018, 10:19 por minecraft

Hi there! I simply wish to give you a big thumbs up for your great info you have got here on this
post. I'll be returning to your website for more soon.

15. El Domingo, Octubre 7 2018, 20:29 por minecraft

This article is genuinely a nice one it helps new web users, who are wishing
in favor of blogging.

16. El Lunes, Octubre 8 2018, 10:05 por minecraft free download 2018

Every weekend i used to visit this site, because i wish
for enjoyment, for the reason that this this web page conations truly pleasant funny stuff too.

17. El Lunes, Octubre 8 2018, 22:44 por minecraft free download 2018

Actually no matter if someone doesn't know afterward its up to other users
that they will assist, so here it takes place.

18. El Martes, Octubre 9 2018, 10:08 por minecraft free download 2018

I was more than happy to discover this web site. I wanted to thank you
for ones time for this fantastic read!! I definitely
really liked every little bit of it and i also have you saved to fav to check out new information in your site.

19. El Martes, Octubre 9 2018, 16:36 por minecraft free download 2018

Right here is the perfect site for everyone who would like to find out about this topic.

You realize a whole lot its almost hard to argue with you (not that I personally will need to…HaHa).

You certainly put a fresh spin on a subject which has been discussed for a long time.
Wonderful stuff, just wonderful!

20. El Martes, Octubre 9 2018, 19:58 por minecraft free download 2018

I am curious to find out what blog system you are working with?

I'm having some minor security problems with my latest blog
and I would like to find something more safe.
Do you have any suggestions?

21. El Miércoles, Octubre 10 2018, 05:34 por minecraft free download 2018

Hi, the whole thing is going fine here and ofcourse every one is sharing facts, that's genuinely fine, keep
up writing.

22. El Miércoles, Octubre 10 2018, 05:52 por minecraft free download 2018

This piece of writing is really a good one it helps new the web
users, who are wishing in favor of blogging.

23. El Jueves, Octubre 11 2018, 08:20 por minecraft free download 2018

Generally I don't learn post on blogs, however I would like
to say that this write-up very compelled me
to check out and do so! Your writing style has been surprised me.
Thank you, quite nice post.

24. El Jueves, Octubre 11 2018, 09:30 por minecraft free download 2018

This is a topic which is close to my heart... Cheers!
Exactly where are your contact details though?

25. El Martes, Octubre 16 2018, 15:32 por tinder dating site

I wanted to thank you for this excellent read!! I certainly
loved every little bit of it. I have got you
saved as a favorite to look at new stuff you post…

26. El Miércoles, Octubre 17 2018, 21:50 por tinder dating site

I am really impressed with your writing talents as smartly
as with the layout for your weblog. Is this a paid topic or did
you modify it yourself? Anyway stay up the nice
high quality writing, it is rare to look a great weblog like this one today..

27. El Jueves, Octubre 18 2018, 08:06 por minecraft secret free download

I'm no longer certain where you are getting your information, however great topic.
I needs to spend some time learning more or figuring out more.
Thank you for magnificent information I was in search of this
information for my mission.

28. El Viernes, Octubre 19 2018, 04:11 por Coconut Oil Benefits

Hello, I think your blog might be having browser compatibility issues.
When I look at your blog site in Safari, it looks fine but
when opening in Internet Explorer, it has some overlapping.

I just wanted to give you a quick heads up! Other then that, very good blog!

29. El Viernes, Octubre 19 2018, 16:47 por Health Benefits of Coconut Oil

Spot on with this write-up, I honestly think this amazing site needs much more attention. I'll probably be back again to read more,
thanks for the advice!

30. El Viernes, Octubre 19 2018, 19:02 por Coconut Oil Benefits

This page certainly has all the information I needed about this
subject and didn't know who to ask.

31. El Domingo, Octubre 21 2018, 14:05 por Benefits of Coconut Oil

This is my first time visit at here and i am actually impressed to read all at alone place.

32. El Domingo, Octubre 21 2018, 14:53 por Coconut Oil Benefits

Right here is the perfect blog for everyone who would like to understand this topic.
You understand so much its almost hard to argue with you (not that I
really would want to…HaHa). You certainly put a new spin on a subject which has been written about for decades.

Great stuff, just great!

33. El Lunes, Octubre 22 2018, 22:16 por Benefits of Coconut Oil

Howdy! Someone in my Myspace group shared this website with
us so I came to look it over. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers!
Fantastic blog and superb style and design.

34. El Martes, Octubre 23 2018, 07:47 por Coconut Oil

Good day! I could have sworn I've been to this website before but after
checking through some of the post I realized it's new to me.
Anyhow, I'm definitely delighted I found it and I'll be book-marking
and checking back often!

35. El Miércoles, Octubre 24 2018, 16:19 por Health Benefits of Coconut Oil

I love it whenever people come together and share thoughts.
Great site, keep it up!

36. El Miércoles, Octubre 24 2018, 22:53 por Health Benefits of Coconut Oil

If some one needs to be updated with most up-to-date technologies then he
must be go to see this web site and be up to date daily.

37. El Viernes, Noviembre 2 2018, 19:39 por descargar facebook

You actually make it seem so easy with your presentation but I find this topic to be actually something that I think
I would never understand. It seems too complicated and extremely broad for me.
I'm looking forward for your next post, I will try to get the hang of it!

38. El Sábado, Noviembre 3 2018, 14:03 por quest bars cheap

Heya! I'm at work surfing around your blog from my new iphone!
Just wanted to say I love reading your blog and look forward to all your posts!

Keep up the fantastic work!

39. El Sábado, Noviembre 3 2018, 14:41 por suplemen otak

I need to to thank you for this wonderful
read!! I absolutely enjoyed every little bit of it. I have you book
marked to look at new stuff you post…

40. El Domingo, Noviembre 4 2018, 02:49 por quest bars cheap

Ahaa, its good discussion about this article here at this weblog,
I have read all that, so at this time me also commenting at this
place.

41. El Domingo, Noviembre 4 2018, 08:15 por quest bars cheap

If some one wants expert view on the topic of blogging afterward i propose him/her to pay a quick visit this weblog, Keep up the nice job.

42. El Domingo, Noviembre 4 2018, 12:13 por descargar facebook

Descargar facebook http://twitter.com/descargar_hq descargar facebook
I'm not sure why but this site is loading incredibly slow for me.
Is anyone else having this issue or is it a problem on my
end? I'll check back later on and see if the problem still exists.

Descargar facebook http://twitter.com/descargar_hq descargar
facebook

43. El Domingo, Noviembre 4 2018, 20:15 por quest bars cheap

Quest bars cheap fitnesstipsnew1 quest bars cheap 516999410492780544 quest bars cheap

For newest information you have to go to see world-wide-web and on the
web I found this website as a best web page for hottest updates.
Quest bars cheap fitnesstipsnew1 quest bars
cheap 516999410492780544 quest bars cheap

44. El Martes, Noviembre 6 2018, 09:16 por Quest Protein Bars

Hi there Dear, are you really visiting this web site on a regular
basis, if so afterward you will absolutely take nice knowledge.

45. El Miércoles, Noviembre 7 2018, 00:50 por Quest Bars Cheap

I every time spent my half an hour to read this blog's articles or reviews
all the time along with a cup of coffee.

46. El Jueves, Noviembre 8 2018, 22:02 por Quest Bars Cheap

Hello! Someone in my Facebook group shared this site with us so I came
to take a look. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to
my followers! Terrific blog and great design and style.

47. El Viernes, Noviembre 9 2018, 06:27 por Quest Bars

This is my first time visit at here and i am actually pleassant to read everthing at
single place.

48. El Sábado, Noviembre 10 2018, 09:44 por Sling TV

obviously like your website however you have to take a look at the spelling
on several of your posts. Several of them are rife with spelling issues and I to find it very
troublesome to tell the reality nevertheless I'll definitely come again again.

49. El Sábado, Noviembre 10 2018, 13:46 por Sling TV

Hello, i believe that i noticed you visited my weblog thus i
came to go back the prefer?.I am attempting to in finding issues to enhance my website!I
assume its good enough to make use of some of your ideas!!

50. El Domingo, Noviembre 11 2018, 06:20 por What Equipment is Needed for Sling TV

There's certainly a great deal to know about this subject.

I really like all of the points you made.

51. El Lunes, Noviembre 12 2018, 06:26 por Sling TV

If you desire to take a great deal from this piece
of writing then you have to apply these methods to your won web site.

52. El Lunes, Noviembre 12 2018, 12:38 por What Equipment is Needed for Sling TV

It's appropriate time to make some plans for the long run and it's time to be happy.
I've read this post and if I may just I desire to recommend you few interesting issues or advice.

Maybe you can write next articles regarding this article.
I wish to read even more issues about it!

53. El Lunes, Noviembre 12 2018, 14:41 por What Equipment is Needed for Sling TV

An impressive share! I've just forwarded this onto a co-worker who has been doing a little homework on this.
And he in fact ordered me lunch because I stumbled upon it for him...
lol. So allow me to reword this.... Thanks for the
meal!! But yeah, thanks for spending some time to discuss this issue here on your site.

54. El Lunes, Noviembre 12 2018, 23:59 por What Equipment is Needed for Sling TV

It is perfect time to make some plans for the future and
it is time to be happy. I've read this post and if I could I desire to suggest you few interesting things or suggestions.

Perhaps you could write next articles referring to this article.
I want to read even more things about it!

55. El Martes, Noviembre 13 2018, 22:35 por What Equipment is Needed for Sling TV

This text is worth everyone's attention. Where can I find out more?

56. El Miércoles, Noviembre 14 2018, 00:54 por What Equipment is Needed for Sling TV

Hi there, I found your site via Google at the same time as searching
for a similar subject, your website got here up, it appears to be like good.

I've bookmarked it in my google bookmarks.

Hello there, just was aware of your blog through Google, and found that it's
really informative. I'm gonna be careful for brussels. I'll be grateful if you proceed this in future.

Many folks shall be benefited out of your writing.
Cheers!

57. El Miércoles, Noviembre 14 2018, 09:58 por Sling TV

Hi there to all, since I am actually keen of reading this website's post to be updated regularly.
It carries good information.

58. El Miércoles, Noviembre 14 2018, 16:55 por Sling TV

I enjoy what you guys are usually up too. This kind of clever work and reporting!
Keep up the superb works guys I've added you guys to blogroll.

59. El Jueves, Noviembre 15 2018, 08:08 por Sling TV

It's a pity you don't have a donate button! I'd certainly donate to this outstanding
blog! I guess for now i'll settle for bookmarking and adding your RSS
feed to my Google account. I look forward to brand new updates and
will talk about this website with my Facebook group.
Talk soon!

60. El Jueves, Noviembre 15 2018, 09:30 por Sling TV

I for all time emailed this webpage post page to all my friends, because if like to read it after that my links will too.

61. El Jueves, Noviembre 15 2018, 13:55 por Sling TV

Yes! Finally something about Sling TV.

62. El Viernes, Noviembre 16 2018, 13:03 por What Equipment is Needed for Sling TV

Your method of telling everything in this post is really pleasant, every one can without
difficulty be aware of it, Thanks a lot.

63. El Viernes, Noviembre 16 2018, 21:28 por sling tv coupons and promo codes for november 2018

Sling tv coupons and promo codes for november 2018
I'm extremely inspired with your writing abilities as smartly as with the layout
to your weblog. Is this a paid theme or did you customize it yourself?
Anyway keep up the excellent quality writing, it is rare to look a great weblog like this
one today.. Sling tv coupons and promo codes for november 2018

64. El Sábado, Noviembre 17 2018, 10:42 por What Equipment is Needed for Sling TV

Wonderful beat ! I would like to apprentice while
you amend your website, how can i subscribe for a blog web site?
The account aided me a acceptable deal. I had been a little bit
acquainted of this your broadcast offered bright
clear idea

65. El Sábado, Noviembre 17 2018, 11:02 por sling tv coupons and promo codes for november 2018

Sling tv coupons and promo codes for november 2018
Your style is really unique compared to other people I have read stuff from.
Thank you for posting when you've got the opportunity, Guess I'll just bookmark
this site. Sling tv coupons and promo codes for november 2018

66. El Domingo, Noviembre 18 2018, 14:11 por What Equipment is Needed for Sling TV

Hi! I'm at work surfing around your blog from my new iphone 3gs!
Just wanted to say I love reading through your blog and look forward
to all your posts! Carry on the outstanding work!

67. El Domingo, Noviembre 18 2018, 22:35 por What Equipment is Needed for Sling TV

Excellent site you have here but I was wanting to know if you knew of any forums
that cover the same topics talked about here? I'd really love to be a part of community where
I can get feed-back from other experienced
individuals that share the same interest. If you have any recommendations,
please let me know. Thanks!

68. El Lunes, Noviembre 19 2018, 02:19 por What Equipment is Needed for Sling TV

I love what you guys are up too. Such clever work and exposure!
Keep up the wonderful works guys I've incorporated you guys to our blogroll.

69. El Lunes, Noviembre 19 2018, 12:48 por What Equipment is Needed for Sling TV

When someone writes an post he/she maintains the thought of a user in his/her mind that how a
user can know it. So that's why this post is outstdanding.
Thanks!

Añadir un comentario

El código HTML se muestra como texto y las direcciones web se transforman automáticamente.

Discusiones sobre el mismo tema

URL de retroenlace : http://creativapixel.com/blog/index.php?trackback/4

1767 reads