PHP 5.1.2 on IIS6 test.php works but index.php prints sytax

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
visitor-Q
Forum Commoner
Posts: 72
Joined: Mon Feb 05, 2007 1:40 am

PHP 5.1.2 on IIS6 test.php works but index.php prints sytax

Post by visitor-Q »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


we are reconfiguring the directory structure for a client of ours. unfortunately they are running on IIS. i have had a lot of trouble configuring everything correctly but after i followed [url=http://www.peterguy.com/php/install_IIS6.html]this guide[/url] for the most part, and now i am much closer to completing this install than ever before.

test.php works fine:

Code: Select all

<html>
	<head>
		<title>PHP Test</title>
	</head>
	<body>
		<!-- testing sessions -->
		<?php session_start(); ?>
		
		<!-- testing browscap.ini -->
		<?php
			echo $_SERVER['HTTP_USER_AGENT'] . "<br/><br/>";
			$browser = get_browser(null, true);
			print_r($browser);
			echo "<br/><br/>";
		?>
		
		<!-- a general PHP test -->
		<?php phpinfo(); ?>
	</body>
</html>
but when i run my index.php, it just prints like half the php syntax onto the browser. what could be wrong here?


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Does your index.php always use <?php or maybe sometimes <? or even <% ?
visitor-Q
Forum Commoner
Posts: 72
Joined: Mon Feb 05, 2007 1:40 am

Post by visitor-Q »

volka wrote:Does your index.php always use <?php or maybe sometimes <? or even <% ?
volka, thanks for the reply. these webpages were built by somebody else, and they often use short headers in their code (<? code ?>). i'm glad you mentioned this because it makes total sense why syntax would be printed to the browser... it does not recognize the PHP headers. where would i find out what file or configuration setting is responsible for interpereting the PHP headers?
Last edited by visitor-Q on Mon Feb 12, 2007 1:24 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The above posted code shouldn't work entirely. Headers have already been sent before session_start() is called nullifying the session starting.
visitor-Q
Forum Commoner
Posts: 72
Joined: Mon Feb 05, 2007 1:40 am

Post by visitor-Q »

feyd wrote:The above posted code shouldn't work entirely. Headers have already been sent before session_start() is called nullifying the session starting.
afaik, it works just fine, the only error i get is at the very bottom for the get_browser() function. browscap ini directive not set. i'm aware of this error, and what it takes to fix it. the rest is working fine. after i moved the session_start() to the very top, nothing changed.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

visitor-Q wrote:and they often use short headers in their code (<? code ?>)
Those are called short tags.
You can "enable/disable" them e.g. in your php.ini, see http://de2.php.net/manual/en/ini.core.p ... t-open-tag
Do not forget to restart your webserver if php is installed as module.
visitor-Q
Forum Commoner
Posts: 72
Joined: Mon Feb 05, 2007 1:40 am

Post by visitor-Q »

volka wrote:
visitor-Q wrote:and they often use short headers in their code (<? code ?>)
Those are called short tags.
You can "enable/disable" them e.g. in your php.ini, see http://de2.php.net/manual/en/ini.core.p ... t-open-tag
Do not forget to restart your webserver if php is installed as module.
thank you volka, i did some research on my own and came to the same conclusion. i found that my short_open_tag setting was 'Off'. i turned it 'On' and restarted IIS, but i still have the same problem. it is outputting syntax to my browser. it could be a mysql issue, possibly: this is some of the syntax it is outputting to the browser...

Code: Select all

SELECT NICKNAME from members WHERE ID='137'PHP Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'user'@'localhost' (using password: YES) in D:\Htdocs\rockdaleisd.net\azureadmin\lib\db.php on line 11 PHP Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in D:\Htdocs\rockdaleisd.net\azureadmin\lib\db.php on line 13 PHP Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in D:\Htdocs\rockdaleisd.net\azureadmin\lib\db.php on line 17 PHP Warning: fopen(./debmes.txt) [function.fopen]:.....................
what do you think?
visitor-Q
Forum Commoner
Posts: 72
Joined: Mon Feb 05, 2007 1:40 am

Post by visitor-Q »

at second glance, i was wrong. it is no longer the same issue, it is a mysql configuration issue. it seems as if i need to reinstall mysql correctly. thanks for all the help! =) i'll let you know how it works out.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

PHP Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'user'@'localhost' (using password: YES)
see http://dev.mysql.com/doc/refman/5.0/en/ ... enied.html
Post Reply