Adding .phps to Apache2

Discussion in 'Web Design & Coding' started by Glaanieboy, Oct 1, 2003.

  1. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    I want to make my php scripts available to the public, I know that you can copy the file to an extension of phps to see a color-formatted source. But I don't know how to do it on my own installation of Apache2 and php (on Windows XP). What I have done is added these two lines to httpd.conf:
    Code:
    AddType application/x-httpd-php-source .phps
    Action application/x-httpd-php-source "/php/php.exe -s"
    But when I click on a phps file, I get a file not found error. If I remove these two lines, restart Apache2 and click them again, I get the source, but no colors.
    What should I do to enable colorformatted phps viewing?
     
  2. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
  3. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
  4. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    Thanks.
    However, the question still stands, as it is easy to quickly copy/rename a file when someone asks for the source.
    In addition to my question:
    I don't know if this is a bug in Firebird, but when I click a link with a .msi or .rar file, instead of downloading the file, it shows the binary code in the browser window. How can I tell Apache to tell the browser to download the file? Or is this browser-related?

    I can understand why some of you people think RTFM!, but I don't quite understand the manual sometimes, maybe this is because English is not my native language, or maybe I am too much of a n00b.
     
  5. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    The advantage of show_source is that the source is updated as the file is, not good if there are passwords in the file, but ok for most uses (btw, all .phps files I've seen just display plain text, unless they where created from the command line/with cat)

    As for FireBird, it can be both, but most of the time its to do with MIME types, theres info on how to add them to apache here: http://www.bignosebird.com/apache/a1.shtml
     
  6. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    I have always seen anything with phps on the end as color coded PHP souce, so yeah.

    Anyways, the addtype is all you should need, i dont know though.
     
  7. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    <IfModule mod_php4.c>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    </IfModule>

    Is what i got in my config file. Apachel 1.3.x
     
  8. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    WTF is this thread doing in Coding and Design? I have spent 15 mins searching for it, (it was originally posted in Applications)
     
  9. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
     
  10. Khayman

    Khayman I'm sorry Hal... Political User Folding Team

    Messages:
    5,518
    Location:
    England
    I felt it had more relevancy, and would get better response, in here.

    How can you spend 15 minutes looking for any post. See the search buton below every post. It will list every post by that member
     
  11. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    He aint that smart ;).
     
  12. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    Houd je bek
     
  13. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    Hey, geen slechte taal. Ook al is het in het nederlands, er zijn nog meer nederlanders.
     
  14. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    bleh! I was only joking...
     
  15. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    I know.