473,574 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mssql Iis6

11 New Member
Hi. I'm a newbie to PHP and am having a few problems as follows...

I have installed PHP successfully on server 1 which is running IIS 6 (W2k3) and hosting multiple sites, some of which connect to MSSQL 2k (SP4) on server 2 (using ASP).

I can load a basic 'Hellow world' PHP page hosted on server1 but when I add the code to create a simple connection to MSSQL on server 2, my PHP doesn't seem to connect nor output any of the desired query results to screen (e.g. number of rows in a table). I have placed 3 echo statements in amongst this page in order to see what is being processed successfuly as I have no other information as to where the failure may lie. Where can I find PHP error logs?

echo1, which appears at the start of the php script, writes to the screen fine.

echo2, which appears immediately after the MSSQL connection variable definition, does not write to the screen.

echo2, which appears after the MSSQL query results are to be written to the screen, does not write to the screen (nor do the query results).

The PHP script I am using is as follows:

<?php
echo '<p>line 1</p>';

$con = mssql_connect(' MSSQLINSTANCE', 'username','pas sword') or die("Connection failed");

echo '<p>line 2</p>';

mssql_select_db ('DATABASENAME' , $con);
$sql = 'SELECT * FROM sys.tables';
if ($res = mssql_query($sq l, $con)) {
print(mssql_num _rows($res) . " tables in database.\n");
} else {
print("SQL failed.\n");
}
mssql_close($co n);

echo '<p>line 3</p>';

?>


Obviously, the values in CAPS above are replaced with the appropriate values for the MSSQL instance on server 2, administrator username, administrator password, and db name.

I have followed all the manuals, discussion boards and instructions I can find on the net and still no joy. I have named pipes and TCP/IP enabled on the MSSQL server. I have also addressed the issue of the ntwdblib.dll file version, by copying from the SQLserver across to the PHP directory and system32 directory on server1.

In addition to the problem above, and tracking back as far as I can, I am unable to get the file phpinfo.php to load on server1. I guess that I first of all need to solve this problem before tackling the MSSQL connection issue.

The phpinfo.php file reads a follows:

<?
phpinfo();
?>


All advice appreciated. Thanks in advance
Jul 28 '07 #1
14 2915
kovik
1,044 Recognized Expert Top Contributor
It sounds to me as though you have error_reporting turned off if your script fails at mssql_connect() , but doesn't tell you. You need to turn error_reporting on.

The problem is likely that the mssql extension is not loaded in your php.ini. Look in your php.ini and find this line:

extension=php_m ssql.dll

Does it have a semicolon ahead of it? If so, remove the semicolon, save the file, and restart your server.
Jul 28 '07 #2
guswebb
11 New Member
ok. so now i'm making a little progress. i have turned on error reporting and now have the following error:

Parse error: syntax error, unexpected T_STRING in C:\filepath on line 10

my entire code is as follows:

<?php
echo "<p>line 1</p>";

error_reporting (E_ALL);
ini_set('displa y_errors', True);

$con = mssql_connect(" MSSQLINSTANCE", "administrator" ,"password") or die("Connection failed");
mssql_connect()

mssql_select_db ("DBNAME");
$sql = "SELECT * FROM TABLENAME";
if ($res = mssql_query($sq l, $con)) {
print(mssql_num _rows($res) . " tables in database.\n");
} else {
print("SQL failed.\n");
}
mssql_close($co n);

echo "<p>line 2</p>";

?>


i removed one of the echo lines that i referred to earlier so there are now only 2, so that i can see when they are written, if at all. currently, using the exact code as above, neither of them are written, nor is anything other than the error message as shown above.

this error message appears to relate to the code that defines that DB name but i can't see what is wrong with this.

any ideas? (and apologies in advance for not grasping what i'm doing wrong!)
Jul 28 '07 #3
mwasif
802 Recognized Expert Contributor
guswebb, kinldy use proper PHP code tags for your source code instead of bold. It will help others to understand your code.
Jul 28 '07 #4
mwasif
802 Recognized Expert Contributor
On line 8, you have mssql_connect() without semicolon but still there is no need for 2nd mssql_connect() . Remove this line.
[PHP]<?php
echo "<p>line 1</p>";

error_reporting (E_ALL);
ini_set('displa y_errors', True);

$con = mssql_connect(" MSSQLINSTANCE", "administrator" ,"password") or die("Connection failed");
mssql_connect()

mssql_select_db ("DBNAME");
$sql = "SELECT * FROM TABLENAME";
if ($res = mssql_query($sq l, $con)) {
print(mssql_num _rows($res) . " tables in database.\n");
} else {
print("SQL failed.\n");
}
mssql_close($co n);

echo "<p>line 2</p>";

?>[/PHP]
Jul 28 '07 #5
guswebb
11 New Member
On line 8, you have mssql_connect() without semicolon but still there is no need for 2nd mssql_connect() . Remove this line.
[PHP]<?php
echo "<p>line 1</p>";

error_reporting (E_ALL);
ini_set('displa y_errors', True);

$con = mssql_connect(" MSSQLINSTANCE", "administrator" ,"password") or die("Connection failed");
mssql_connect()

mssql_select_db ("DBNAME");
$sql = "SELECT * FROM TABLENAME";
if ($res = mssql_query($sq l, $con)) {
print(mssql_num _rows($res) . " tables in database.\n");
} else {
print("SQL failed.\n");
}
mssql_close($co n);

echo "<p>line 2</p>";

?>[/PHP]
i have removed the line 8 code and also checked the extension=php_m ssql.dll entry in the php.ini file as per your PM. i changed this ini file before rebooting, but now it appeared again with a semicolon in front of the line where I had previously removed it. not sure how, maybe i didn't save it when i thought i had.

is the php.ini file only meant to be stored in the windows/system32 folder and not in the C:\PHP install folder?
Jul 28 '07 #6
mwasif
802 Recognized Expert Contributor
You can know the location of php.ini in phpinfo output.
[PHP]<?
phpinfo();
?>[/PHP]
Jul 28 '07 #7
guswebb
11 New Member
and i still have the problem whereby my phpinfo.php file does not load anything other than a blank page, with no errors.

is there something more fundamental wrong with my installation/configuration that i need to get sorted before attempting to troubleshoot the MSSQL connection issue?

my phpinfo.php file reads...

[PHP]<? phpinfo() ?> [/PHP]

this renders a blank page, but from what i've read elsewhere, it should load a summary of my system's settings. is this correct?
Jul 28 '07 #8
guswebb
11 New Member
You can know the location of php.ini in phpinfo output.
[PHP]<?
phpinfo();
?>[/PHP]

i have resaved the phpinfo.php file containing code exactly as you have typed it and still i get a blank page.
Jul 28 '07 #9
mwasif
802 Recognized Expert Contributor
from what i've read elsewhere, it should load a summary of my system's settings. is this correct?
It should load a summary.

Have you turned on error reporting? Try this code instead
[PHP]<?php
error_reporting (E_ALL);
phpinfo();
?>[/PHP]
Jul 28 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

7
23865
by: mj | last post by:
Hello, thanks for the help. I am running a WinXP Pro w/ SP2 (my home computer, with ZoneAlarm firewall) Apache 2.0.52 MySQL 4.1.7 PHP 5.1.0-dev I have developed a PHP/MySQL web app that tracks jobs for me, and we
1
2101
by: JackTorrance | last post by:
Hi i have a problem with IIS6 and MSSQL and i hope that someone can help me. this is the configuration: Windows 2003 IIS6 MSSQL 7.0 Standard Edition ADO 2.5
3
4306
by: gharmel | last post by:
I'm trying to get some clues on why I get (much) slower responses from my PHP applications when dealing with a remote sql server as opposed to a local sql server. Here's my situation: Server #1 MSSQL 2000 sp4 Windows 2000 Server PHP4 on IIS5 (CGI)
16
1752
by: davemateer | last post by:
Hi We have a current system: Linux / Apache / PHP4.x talking to Microsoft SQL 2000 Thinking about going to: Windows 2003 / PHP4.x talking to the same Microsoft SQL 2000 box...
8
10543
by: eugenio | last post by:
Hi...not sure if this is the right group for this posting, but i'm don't know where else to post. I've got a simple problem...I have a linux box running apache 2.0 and php5. I'm trying to use the mssql functions in php to retreive data from a mssql server 2k. I'm pulling data from the customers table in the northwind db and i'm getting...
2
4950
by: vrba | last post by:
Hi, I need one web site in UTF8 with MSSQL2005 (customer request) Configuration: IIS6+PHP5/Win2003 (Czech locales)--> MSSQL/Win2003 Database returns data in CP1250, rest is correct in UTF8. I was tray Freetds. Config file I have in c:\freetds.conf, but IIS don't read it (probably) and don't use 'client encoding = UTF-8'.
2
2757
by: Andrew Wan | last post by:
Okay, this is really weird. We have two Windows 2003 Server SP1 PCs. One hosts IIS6 website, and the other hosts our DCOM service program. Our website is ASP/XSL. An ASP page uses Msxml2.DOMDocument.4.0 to transform a XML top node via XSL stylesheet outputting to HTML. We have set up the website on-site successfully with no problems. However,...
6
1535
Ryan F Bracy
by: Ryan F Bracy | last post by:
I'm currently a computer networking student, and a semester long project this year requires us to build an online store using IIS6 and MSSQL. I have run into a dead end in this project and cannot find information or documentation that answers my questions. So as follows. How do I store an image in the MSSQL database, preferably through a...
1
2732
by: lilOlMe | last post by:
Can you install IIS6 on a system other than Windows Server 2003? I'd like to install IIS6 on Windows XP. I've been trying to find out the system requirements for IIS6 but I haven't found a clear article that outlines which operating systems it will work on. I gathered that it works on Windows Server 2003...but there's no mention of it...
0
7803
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8230
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6451
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5618
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5299
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3739
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3749
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2240
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1056
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.