Enabling PHP

KnightB4

New Member
Could be a newbie question, but I have not found the solution anywhere.

I have a brand new VPS, everything seems to be set up correctly but when I try to use php (either phpinfo() or any echo statement), nothing happens.
I have done a fair amount of reading, I have played with the options in the WHM "Configure Suexec and PHP" screen, but nothing happens.
(I am running Apache 2.x and PHP 5.x).

Did you need to do anything to enable PHP when you got your VPS?

Thanks for your help.
Louis
 

KH-Paul

CTO
Staff member
Louis,

PHP is installed / enabled by default.
What do you see while trying to access php page? Blank screen, error, attempt to download code or something else? If there anything in Apache log file at /usr/local/apache/logs/error_log?

Regards,
Paul
 

KnightB4

New Member
Hi Paul,

Nothing between the php tags gets displayed. The HTML before the PHP tags is displayed. The same code runs fine on my local server:
<?php
echo "php is here";
phpinfo();
?>

error_log doesn't show anything when I access that page
error_log shows "PHP/5.2.5 configured" each time I try to tweak php/suexec setup.

I may be doing something stupid but I cannot figure it out.

Louis
 

KH-Paul

CTO
Staff member
Louis,

Do you have a .htaccess file in any directory up to the directory where your php file is located?
 

KnightB4

New Member
No, this is just a stupid test file:

toto
<?php
echo "php is here";
phpinfo();
?>
nothing else after this


It prints first and last line, but nothing in between.
Louis
 

KnightB4

New Member
All right, this is it. Renaming it did the trick. Thanks a lot!

I thought Apache didn't care: .html, .php or anything.
Is there a configuration somewhere for that?

Louis
 

KnightB4

New Member
I read somewhere that you do not have to save your PHP files as .php

This may be correct for stand-alone/CLI php, but not on a web server?

Louis
 

KnightB4

New Member
Amen, that's where I got confused.

Also, you can name your php include files whatever you want. That added to my confusion.

Anyway, I'll remember that now!
Thanks,
Louis
 
Top