...

View Full Version : echo "Hello World"; problem! problem! problem!



hanpedro
07-09-2005, 04:14 AM
I have a machine with win xp sp2, apache 2.0.54, php 4.3.11, mysql 4.3.12 and bbs web application.

1.
<?php
echo "Hello World"; ?>
-> empty screen.

2.
<?php
echo "ttt";
?>
-> empty screen
3.
<?php
echo <<<END
test
END;
?>
-> empty screen

4.
<?php
echo "Hello World";

echo "이는 여러
줄을 표현합니다. 물론 뉴라인도
출력합니다.";

echo "이는 여러\n줄을 표현합니다. 물론 뉴라인도\n출력합니다.";

echo "문자 이스케이핑은 \"이렇게\" 합니다.";

// echo 구문 안에 변수를 사용할 수 있습니다.
$foo = "foobar";
$bar = "barbaz";

echo "foo는 $foo"; // foo는 foobar

// 배열을 사용할 수도 있습니다.
$bar = array("value" => "foo");

echo "이것은 {$bar['value']} !"; // 이것은 foo !

// 작은 따옴표는 변수값이 아닌, 변수명을 출력합니다.
echo 'foo는 $foo'; // foo는 $foo

// 다른 문자를 사용하지 않는다면, 바로 변수를 echo할 수 있습니다.
echo $foo; // foobar
echo $foo,$bar; // foobarbarbaz

// 몇몇 사람들은 결합 echo보다 복수 인자 사용을 선호합니다.
echo 'This ', 'string ', 'was ', 'made ', 'with multiple parameters.', chr(10);
echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\n";

echo <<<END
이는 $variable 인터폴레이션을 가지는 여러 줄을
출력하는 "here document" 구문을 사용합니다. here
document 종료어는 줄에 세미콜론만을 가지고 있어야
하며, 어떠한 공백도 없어야하는 점에 주의하십시오!
END;

// echo는 함수가 아니기에, 다음 코드는 유효하지 않습니다.
($some_var) ? echo 'true' : echo 'false';

// 그러나, 다음 예제는 작동합니다.
($some_var) ? print('true'): print('false'); // print는 함수입니다.
echo $some_var ? 'true': 'false'; // 구문을 변경하여 처리
?>
->

"foo"); echo "이것은 {$bar['value']} !"; // 이것은 foo ! // 작은 따옴표는 변수값이 아닌, 변수명을 출력합니다. echo 'foo는 $foo'; // foo는 $foo // 다른 문자를 사용하지 않는다면, 바로 변수를 echo할 수 있습니다. echo $foo; // foobar echo $foo,$bar; // foobarbarbaz // 몇몇 사람들은 결합 echo보다 복수 인자 사용을 선호합니다. echo 'This ', 'string ', 'was ', 'made ', 'with multiple parameters.', chr(10); echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\n"; echo <<

However, the bbs web application is working.

Is there anything wrong in php.ini?

Len Whistler
07-09-2005, 04:42 AM
<?php
echo "Hello World";
?>


Will work.

Make sure you name your file with the .php extension. index.php

hanpedro
07-09-2005, 05:31 AM
Dear Len Whistler,

It shows empty screen.

Before posting, I've tried tens of examples.

I think something wrong in php.ini or php's bug.

Velox Letum
07-09-2005, 07:41 AM
I highly doubt it is a bug in PHP. More likely, it is an incorrect server configuration.

Kurashu
07-09-2005, 07:43 AM
I have a machine with win xp sp2, apache 2.0.54, php 4.3.11, mysql 4.3.12 and bbs web application.

Like the bolded one? =P

Bill Posters
07-09-2005, 09:34 AM
Possibly a stupid question, but… are you viewing the php file directly (i.e. file://…) or via the http address. In case you weren't already aware, you need to view php files via their local http address in order for the php to be parsed.

hanpedro
07-09-2005, 10:21 AM
Dear Kurashu,

I dislike it too, but I have to use it for graphic works. So I should work with this machine and upload linux.

Dear Bill Posters,

I tried it on localhost and my domain. So I am considering format win xp.

The php company says new php version released with this statement.
"As the improved reference support in PHP 4.4 might show as notices and warnings in your existing applications - in cases where PHP formerly just silently ignored this and often causing memory corruptions - we also recommend to test PHP 4.4.0RC2 with your applications. The final release is planned for July 11th. PHP 4.4.0RC2 can be found here.
"

Kurashu
07-09-2005, 11:02 AM
Dear Kurashu,

I dislike it too, but I have to use it for graphic works. So I should work with this machine and upload linux.

It was a joke.

BaDgEr
07-09-2005, 07:27 PM
Have you tried setting display_errors = On, to see if it actually complains about anything? Might shed some light on the problem if it has something to whine about ;)

*edit* also you should confirm that PHP is actually installed properly within Apache.. because a simple echo statement shouldn't really give any problems unless something went wrong during install.

Anthony2oo4
07-09-2005, 07:55 PM
right click and click view source, tell us whats the source code says. See if it is acctually doin anythin.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum