Enabling PHP

Discussion in 'Linux VPS/Dedicated - cPanel' started by KnightB4, Feb 12, 2008.

  1. KnightB4

    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
     
  2. KH-Paul

    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
     
  3. KnightB4

    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
     
  4. khiltd

    khiltd New Member

    Do you have an output buffer starting up from a file included before this code?
     
  5. KH-Paul

    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?
     
  6. KnightB4

    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
     
  7. KH-Paul

    KH-Paul CTO Staff Member

    PM me a link to this page, I'll take a quick look
     
  8. KH-Paul

    KH-Paul CTO Staff Member

    Louis,

    Thanks for your PM. Try to rename the file from index.html to index.php.
     
  9. KnightB4

    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
     
  10. khiltd

    khiltd New Member

    If it wasn't being parsed as PHP then the output should have been there in the page source.
     
  11. KnightB4

    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
     
  12. khiltd

    khiltd New Member

    You can name your files whatever you like as long as you tell Apache how to handle them.
     
  13. KnightB4

    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
     

Share This Page