Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I try to test my php installation on a ubuntu server without gui. Therefore I follow the 3rd this howto for LAMP(!). This includes to install php5 et al. with

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

Then PHP is added to the directory index.

sudo nano /etc/apache2/mods-enabled/dir.conf

So that the file is:

<IfModule mod_dir.c>
          DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

I have the file /var/www/info.php like this:

<?php 
phpinfo();
?>

There is no output, when I try to reach the page on another machine with

http://hostname/info.php 

index.html shows me 'It works!', but /var/log/apache2/error.log shows error:

[..date..] [mpm_prefork:notice] [pid 13057] AH00163: Apache/2.4.6 (Ubuntu) SVN/1.7.9 PHP/5.5.3-1ubuntu2.1 mod_perl/2.0.8 Perl/v5.14.2 configured -- resuming normal operations
[..date..] [core:notice] [pid 13057] AH00094: Command line: '/usr/sbin/apache2'
[..date..] [:error] [pid 13064] [client 192.168.x.n:59821] PHP Parse error:  syntax error, unexpected '<' in /var/www/info.php on line 3
[..date..] [:error] [pid 13065] [client 192.168.x.n:59822] script '/var/www/index.php' not found or unable to stat

x and n are numbers, n is the ip of the client trying to access the page.

Output of cat /var/www/info.php

<?php
<h3 align="center">"Awesomeness has no charge" - Po the Panda</h3> <-- here is the error...ok, thx.
phpinfo();
?>

And

$ ls -la /var/www/info.php
-rw-r--r-- 1 root root 86 Feb  1 23:33 /var/www/info.php
share|improve this question
    
Do cat /var/www/info.php and show us the full output. –  Lucio Feb 1 at 22:27
    
I think this is permission issue. Please provide the output of ls -la /var/www –  arhimed Feb 1 at 22:30
    
Ah, even if it was to easy... The output is shown above. I thought I tried it (but it was not so): When deleting the line with the Panda everything is fine. –  Stefan Bollmann Feb 1 at 22:36
    
@StefanBollmann Did you solved the problem? If so, please write a new answer detailing how. –  Lucio Feb 1 at 22:38
3  
This is a code problem. You have put raw HTML into your <?php ... ?> tag, that obviously can't work. That's literally what the error tells you: Syntax error. Because the interpreter has no idea what to do with this random completely different language in there. –  user98085 Feb 1 at 22:45

1 Answer 1

up vote 0 down vote accepted

The error was in info.php:

<?php
<h3 align="center">"Awesomeness has no charge" - Po the Panda</h3> <-- here is the    error...ok, thx.
phpinfo();
?>

By deleting the line with

<h3 align="center">"Awesomeness has no charge" - Po the Panda</h3>

everything is as expected. The info.php is now (as in many documentations..)

<?php
phpinfo();
?>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.