Page 1 of 2
Basic PHP issues
Posted: Wed Jul 09, 2003 6:18 pm
by mcraft59
Hello,
I'm currently making a flash webpage and I'm learning PHP for my guestbook. I'm familiar with java, C, and I've learned a great deal about Flash ActionScript. However, PHP is giving me some problems. I've started small with the tutorials that my book has told me to do. I checked my web host to make sure it has php running
http://www.mcraft59.com/version.php and I get the info-screen, but there looks like some extra text at the top and bottom. Is that supposed to be there?
Eitherway I went ahead and did the basic "Hello World" script. My php file consists of a header, followed by a short PHP code in the code, and my output is totally whacked.
http://www.mcraft59.com/try.php I can see "hello world" mixed in a bunch of additional junk that I assume my web host is throwing in. Or am I doing something wrong? Below is the code.
try.php
---------------------------
<html>
<head>
<title>Look out world</title>
</head>
<body>
<?php echo 'hello, world!' ?>
</body>
</html>
Re: Basic PHP issues
Posted: Wed Jul 09, 2003 6:32 pm
by McGruff
mcraft59 wrote:Hello,
Code: Select all
<?php
<html>
<head>
<title>Look out world</title>
</head>
<body>
<?php echo 'hello, world!'; ?> // must terminate this line with a semi_colon
</body>
</html>
?>
I'd recommend installing a local server to test your scripts - saves a lot of time ftp'ing up and down.
http://www.hotscripts.com/PHP/Software_ ... tion_Kits/
Also, if you don't have one already, I'd recommend downloading a copy of the php manual from php.net (get the one with user comments - explains much that is not in the bare manual).
Posted: Wed Jul 09, 2003 7:50 pm
by mcraft59
I originally had the ";" after that line of code, but my "O'Reilly" book's example does not have it. Eitherway if it added it doesn't change the result and by adding the "<?php ---- ?>" code to the beginning and end of the file changes my output to a blank page. I think their might be an error with my web host or something. I'm at work right now so when I get home I'll download the php-kit and create a local php server.
Thanks for your help
Posted: Wed Jul 09, 2003 7:56 pm
by qartis
The last command in a block of <?php doesn't need a semicolon, but it's a good habit to include it anyway.
What happens when you have a PHP script like this:
That would work on any version of php, and any settings in php.ini.
Posted: Thu Jul 10, 2003 8:18 pm
by mcraft59
I tried that code and I got a blank screen once again
http://www.mcraft59.com/work.php
work.php
---------------
<?php
echo "Hello";
?>
Posted: Fri Jul 11, 2003 1:07 pm
by qartis
Usually the *only* time PHP ever gives me a blank screen is if error_reporting is off, and there's a fatal parse error. If you View>Source on the blank page, is there nothing at all, or is there <HTML><HEAD></HEAD></HTML>?
Posted: Fri Jul 11, 2003 1:58 pm
by DuFF
He provided a link to the page, the source code is entirely blank.
Posted: Fri Jul 11, 2003 2:24 pm
by m3rajk
are you sure php is set up on the server?
Posted: Fri Jul 11, 2003 2:48 pm
by qartis
He provided a link to the page, the source code is entirely blank.
Sorry, my dns server refused to resolve his domain, so I couldn't see it

Posted: Sat Jul 12, 2003 1:41 pm
by mcraft59
I viewed the source code for the files from IE and all I get is the html tags. I don't know why it will not display the simple echo message. Apparently PHP is enabled on the server because of
http://www.mcraft59/version.php shows that it is installed. Yet no other php scripts will run on the server. Open to any last suggestions on this.
Posted: Sat Jul 12, 2003 1:45 pm
by m3rajk
when i get the info instead of the following i can try to help
The page cannot be displayed
The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings.
--------------------------------------------------------------------------------
Please try the following:
Click the Refresh button, or try again later.
If you typed the page address in the Address bar, make sure that it is spelled correctly.
To check your connection settings, click the Tools menu, and then click Internet Options. On the Connections tab, click Settings. The settings should match those provided by your local area network (LAN) administrator or Internet service provider (ISP).
If your Network Administrator has enabled it, Microsoft Windows can examine your network and automatically discover network connection settings.
If you would like Windows to try and discover them,
click Detect Network Settings
Some sites require 128-bit connection security. Click the Help menu and then click About Internet Explorer to determine what strength security you have installed.
If you are trying to reach a secure site, make sure your Security settings can support it. Click the Tools menu, and then click Internet Options. On the Advanced tab, scroll to the Security section and check settings for SSL 2.0, SSL 3.0, TLS 1.0, PCT 1.0.
Click the Back button to try another link.
Cannot find server or DNS Error
Internet Explorer
Posted: Sat Jul 12, 2003 2:03 pm
by mcraft59
lol, wrong link. Forgot the ".com"
Source Code:
http://www.mcraft59.com/version.php
version.php
--------------
<?php phpinfo() ?>
http://www.mcraft59.com/try.php
try.php
-----------------
<html>
<head>
<title>Look out world</title>
</head>
<body>
<?php echo 'hello, world!'; ?>
</body>
</html>
Posted: Sat Jul 12, 2003 2:12 pm
by mcraft59
omfg I got it working I think. Damn web host stuck these "\par" in everyline of my code plus some header. So I went in and re-editted my php code and deleted all their server side added junk.
Posted: Sat Jul 12, 2003 2:13 pm
by m3rajk
hmmm... why the "{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.15.1503;}\viewkind4\uc1\pard\f0\fs20 " at the top?
i have "hello, world! } " displayed by the second link (now)
i think there might be something wrong int he installation
Posted: Sat Jul 12, 2003 2:25 pm
by macewan
are you using notepad or microsoft word to create this file?