Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PHP Tutorial outputs "Hello World '; ?> "

41 views
Skip to first unread message

nolo...@gmail.com

unread,
Feb 1, 2017, 1:56:31 PM2/1/17
to
I'm working through PHP's Hello World tutorial from the manual at "A simple tutorial" (http://secure.php.net/manual/en/tutorial.php). I installed `apache2` and `php` on Ubuntu 16.10 desktop. I tested the install by navigating to the IP address, and I got the expected index page with details about the installation.

Next, I pasted the following code into a new document `/var/www/html/index.php`, performed a `dos2unix` on it, and made it executable. The code came from "Your first PHP-enabled page" (http://secure.php.net/manual/en/tutorial.firstpage.php).

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>

It results in the following (image at https://postimg.org/image/qwdjpvg4f/):

Hello World

'; ?>

I'm doing something wrong, but its not obvious to me what it is. I'm guessing the manual left out a step or two.

What am I doing wrong?

nolo...@gmail.com

unread,
Feb 1, 2017, 2:24:20 PM2/1/17
to
My bad... I should have supplied these:

# php --version
PHP 7.0.13-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.13-0ubuntu0.16.04.1, Copyright (c) 1999-2016, by Zend Technologies

# apachectl -V
Server version: Apache/2.4.18 (Ubuntu)
...
0 new messages