PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 9th, 2002, 06:05 PM
gbpenn gbpenn is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 4 gbpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question PHP/SQL won't connect

I have two identical servers. By identical I mean one was built from the RAID of the other. Everything is identical including files, permissions, etc.

One of these servers has functional PHP connectivity to a SQL Server 2000 SP2 box. The other does not.

I have tried the code on this website with the server listed "ONE" as an alias to a named instance of SQL Server (IPADRESS\ONE):
<?php

$myServer = "ONE";
$myUser = "seh";
$myPass = "*****";
$myDB = "seh";

$s = @mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");

$d = @mssql_select_db($myDB, $s)
or die("Couldn't open database $myDB");

?>

Even with this simple code this doesn't work on the second server.

Some information on the second server: it has the same alias in Client Network Utility as the first server. The PHP.ini files are identical (I actually copied the working file over the disfunctional one). Permissions are identical. IIS setup is identical.

Using ODBC I can see the SQL server from this server so the problem is ONLY connecting with PHP.

Please help I am at wits' end.

Reply With Quote
  #2  
Old July 9th, 2002, 06:58 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
hmm, try running php_info() on both servers and see if theirs any differences between them, maybe theirs something left out of the second server that you havent thought about yet.??

if their both the same, then your got problems

Reply With Quote
  #3  
Old July 9th, 2002, 07:11 PM
gbpenn gbpenn is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 4 gbpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
phpinfo

Ok, I'm pretty PHP ignorant. What code would I use to run this? I tried:
<?php

php_info()

?>

and it failed "
Fatal error: Call to undefined function: php_info()"

Sorry for the lack of knowledge.

Reply With Quote
  #4  
Old July 9th, 2002, 07:23 PM
Lindset Lindset is offline
weirdomoderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: Alta, Norway
Posts: 370 Lindset User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to Lindset Send a message via AIM to Lindset
phpinfo();
__________________
Best Regards,
Håvard Lindset

Reply With Quote
  #5  
Old July 10th, 2002, 11:14 AM
DavidM DavidM is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 78 DavidM User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Gblenn -- what kind of error do you get from your second server. You've already checked the obvious: you can ping from one server to another, it knows hot to resolve the hosts names from one to the other, and you have your SQL Server DSN that PHP will use from the one server set up correctlY?

You can always load Enterprise Manager for SQL Server on the machine that does work and make sure you can connect that way or just run Query Analyzer if you're savvy.

Another option would be to create a SQL Server DSN and select the "TEST" button.

There is also a ODBCPing for SQL Server that would allow your client to ping SQL Server using ODBC calls.

Reply With Quote
  #6  
Old July 10th, 2002, 11:33 AM
gbpenn gbpenn is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 4 gbpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
php/sql continued

Thanks for the info. Yes, I already have done the SQL ODBC connection (i.e. setup a DSN and run the Test). Connectivity is perfect. I don't understand why I'm erroring out with PHP. It's ONLY in PHP that this occurs.

I have checked phpinfo() per the recommendation above and everything looks identical. The only difference I noted was that under mmsql->mssql support the Active Links on one displayed 0 and the other displayed 1. That is, one is enabled and one is diabled. But they are using the same php.ini file so is this a dynamic setting?!

I'm at the end of troubleshooting here and am still clueless why it connects from one and not the other.

When I run the simple code above I get a could not connect to sql server "ONE" error.

Reply With Quote
  #7  
Old July 10th, 2002, 12:31 PM
DavidM DavidM is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 78 DavidM User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
You sure you have the same version of PHP? I believe the later versions of PHP have MySQL support compiled into the binary. With older versions, you may need to uncomment the line with the .dll filename and stop/restart server for it to work.


You sure you have the permissions setup within your MySQL database for your remote machine name to connect? In MySQL, you have to not only set permissions for the username, but also the hostname that they connect from. Usually "localhost" is set up by default.

There are a couple good articles explaining how this works on this site. Check your mysql database and look at the "hosts" or "users" table for correct permissions.

Reply With Quote
  #8  
Old July 10th, 2002, 12:41 PM
gbpenn gbpenn is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 4 gbpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'm not using MySQL I'm using MSSQL. Yes, both are v.4.21, same build date.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > PHP/SQL won't connect


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek