Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP not displaying 1

Status
Not open for further replies.

frozenpeas

Technical User
Sep 13, 2001
893
CA
Can anyone see what I'm doing wrong here?

The output of phpinfo() shows up fine.

Here is my little bit of code:

Code:
<?
require_once('/fns/connect.php');
require_once('/fns/output.php');
do_html_header('Welcome');
?>
<form action=&quot;/test2.php&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; name=&quot;form&quot; id=&quot;form&quot;>
  <table width=&quot;25%&quot; border=&quot;0&quot; align=&quot;center&quot; cellpadding=&quot;3&quot; cellspacing=&quot;0&quot;>
    <tr> 
      <td width=&quot;16%&quot; class=&quot;bodyContent&quot;>Username:</td>
      <td width=&quot;84%&quot;><input name=&quot;username&quot; type=&quot;text&quot; id=&quot;username&quot; size=&quot;25&quot; maxlength=&quot;50&quot;></td>
    </tr>
    <tr> 
      <td class=&quot;bodyContent&quot;>Password:</td>
      <td><input name=&quot;password&quot; type=&quot;password&quot; id=&quot;password&quot; size=&quot;25&quot; maxlength=&quot;50&quot;></td>
    </tr>
    <tr> 
      <td> </td>
      <td><input type=&quot;submit&quot; value=&quot;login&quot;></td>
    </tr>
  </table>
</form>
<?
do_html_footer();
?>

This outputs just:

Code:
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<HTML><HEAD>
<META http-equiv=Content-Type content=&quot;text/html; charset=iso-8859-1&quot;></HEAD>
<BODY></BODY></HTML>

Thanks. frozenpeas
 
I posted that at the beginning of this thread. frozenpeas
 
I wouldn't be so fast as to say that sleipnir.

This is the fastest way on an Apache server to mimick his output...

make a
test.php file which just says
<?php

?>

and then load it... you'll have the ouput he posted above.

-Rob
 
Apache 2 in windows anyway, don't feel like testing it on different setups, but I'm fairly sure I've seen that in linux too.
 
Yeah, but the script is clearly not empty.

At least one of three things should happen: you should have the source code sent to the browser, you should get an error message, or you should get the output of an executed script.

However, this script seems to be doing none of the above. Want the best answers? Ask the best questions: TANSTAAFL!
 
frozenpeas:

I believe you've said a script which reads:

Code:
<?php
phpinfo();
?>

Works, right? If the above script is &quot;a.php&quot;, and you create a script called &quot;b.php&quot;, which reads:

Code:
<?php
include ('a.php');
?>

Does b.php produce output identical to a.php?

Does a script, &quot;c.php&quot;, which reads:

Code:
<?php
print 'foo';
phpinfo();
print 'bar';
?>

produce output like the two previous scripts, except for the &quot;foo&quot; and &quot;bar&quot;? Do &quot;foo&quot; and &quot;bar&quot; appear in the source of the output?

Want the best answers? Ask the best questions: TANSTAAFL!
 
Okay, I've been testing this on another server and the problem seems to be the way I am calling the requires.

Error:

Code:
Warning: main(/fns/connect.php) [function.main]: failed to create stream: No such file or directory in /home/user/public_html/admin/register.php on line 2

Fatal error: main() [function.main]: Failed opening required '/fns/connect.php' (include_path='') in /home/user/public_html/admin/register.php on line 2

Code (unsuccessful):

Code:
require_once('/fns/output.php');

Code (successful):

Code:
require_once('fns/output.php');

It doesn't seem to like me referencing the root like that. I also tried an absolute reference. Any idea why it doesn't like this?

Thanks again. frozenpeas
 
You're on a *nix operating system.

On Win32, &quot;/filename&quot; refers to a file that is in the root of the current drive letter.

*nix filesystems do not do drive letters, so &quot;/filesystem&quot; refers to a file that is in the root of the entire filesystem.

Want the best answers? Ask the best questions: TANSTAAFL!
 
Although PHP knows of the virtual server's document root, it's filesystem functions (including include() and require()) are not constrained by it.

So &quot;/filename&quot; refers to a file on the entire filesystem, not the document root of the current virtual web server. Want the best answers? Ask the best questions: TANSTAAFL!
 
I see! That is good to know. Thanks, sleipnir. frozenpeas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top