www.webdeveloper.com
Results 1 to 3 of 3

Thread: php file header

  1. #1
    Join Date
    Aug 2006
    Posts
    301

    Question php file header

    hi guys, i've recently switched from a server that allowed me to create a file without declaring any kind of header info.

    however the new web host i have uses cPanel X and the admin said i should place my files into the public_html folder instead of the www folder, i've done that but only html file will load, he said i should add the header info that editors normally insert automatically to indicate that the document type is a php file because simply naming it .php won't work.

    any one know where i can find the header code he is referring to?

    thanks

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,312
    All I can think that your admin means is that it is only set up to run PHP as CGI. If that is the case and it is a UNIX/Linux server, you may need to add a "shebang" line at the start, but you'll need to know the path to the PHP executable, something like:
    PHP Code:
    #! /etc/bin/php
    <?php
    echo "Hello, World.";
    ?>
    This, however, is rather unusual these days on most PHP-enable web servers, where the web server program is configured to run files named with specific suffixes as PHP scripts. Also, if the above is true concerning the need for the "shebang" line, you typically have to put those files in a CGI-specific directory, not just the base public_html directory. So in summary, I'm a bit confused, and a bit leery of using that web host.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Aug 2006
    Posts
    301

    thanks nogdog

    i don't think it's his server, he has a dedicated server and he said some of the files might have been messed up, so he's gonna wipe my area and let me upload my files again. so hopefully that works.

    at least i'm on vacation, so i could battle with it tomorrow

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles