SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Apr 2002
    Location
    Blacksburg, VA
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Faster way to add PHP bin header to all my php files?

    My server requires me to add the "#!/usr/bin/local/php" line to the top of every php page...
    This is very time consuming (and time wasting) if there are a lot of scripts involved.

    Is there a way I can batch add that line to a number of files at once?

    Thanks

  2. #2
    SitePoint Addict s|k's Avatar
    Join Date
    Apr 2002
    Location
    Hilo, Hawai'i
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is the server configured to run PHP as a CGI or module?
    try and include()

    I dont know the syntax of the line you have to enter except what you wrote but try this:

    Write the include file:

    "#!/usr/bin/local/php

    save it as my_server_config_sucks.inc

    and then on top of all your php pages put this





    PHP Code:
    <?php include "./my_server_config_sucks.inc";

    script here...

    ?>
    this wont work if you have to have that line before "<?php" if that is the case maybe use a text editor that uses templates and then add the line to your template, and then it will be added on all the pages you script using the editor.

    Hope that helped

  3. #3
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nope, that won't work. it has to be at the top of any file that's actually called, not an include. just like `#!/usr/bin/perl' for Perl scripts.

    CDM_ipGamer, i guess you could make some kind of script to go through any .php files and write "#!/usr/bin/local/php\n" + the file's [original] contents back to the file.

    you'd have to have the files writable by PHP temporarily for this...

    but yeah, that server config does suck.
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  4. #4
    SitePoint Addict s|k's Avatar
    Join Date
    Apr 2002
    Location
    Hilo, Hawai'i
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh, thats peculiar :/

    I use edit plus for a text editor. I like it, I paid the registration fee, but you can use it free for 30 days. You could use the template function for any new php scripts you may write and it will add the line for you whenever you begin a new file.
    Last edited by s|k; May 4, 2002 at 01:51.


Bookmarks

Posting Permissions

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