Run PHP scripts outside of the web directory

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Aggelos

    #1

    Run PHP scripts outside of the web directory

    Hello,
    Is it possible to run a script that will be used from all the websites
    on the server outside of the web dir ?
    At the moment for every site I have I upload the script in the web dir
    of the specific site...

    Specifically it is a RichEditor so it has javascripts as well ...
    But it is difficult to maintain updates of the script to all websites
    so I would prefer if I had only one place to update it...

    Any ideas will be appreciated.

    Angelos.

  • Jim Carlock

    #2
    Re: Run PHP scripts outside of the web directory

    "Aggelos" asked...
    : Is it possible to run a script that will be used from all the
    : websites on the server outside of the web dir ?

    If the server is a Windows server, take a look at these
    two commands inside a cmd.exe prompt...

    help ftype
    help assoc

    The goal involves placing php.exe into the path and then
    associating the required php extensions to a common file
    type.

    If PHP is installed upon a Unix/Linux server, someone else
    might be able help there.

    --
    Jim Carlock
    Post replies to the group.


    Comment

    • Aggelos

      #3
      Re: Run PHP scripts outside of the web directory

      If the server is a Windows server, take a look at these
      two commands inside a cmd.exe prompt...
      Nope it is Unix. :(

      Thanks

      Comment

      • Willem Bogaerts

        #4
        Re: Run PHP scripts outside of the web directory



        Aggelos wrote:
        Hello,
        Is it possible to run a script that will be used from all the websites
        on the server outside of the web dir ?
        At the moment for every site I have I upload the script in the web dir
        of the specific site...
        >
        Specifically it is a RichEditor so it has javascripts as well ...
        But it is difficult to maintain updates of the script to all websites
        so I would prefer if I had only one place to update it...
        >
        Any ideas will be appreciated.
        As it contains javascript, I understand that it has to be
        browser-accessible. In that case, and since you are running unix, I
        think a symbolic link is the easiest way.

        Another approach is to share the directory in a source code control
        system (subversion, for instance), but this will result in physical
        multiple copies.

        Best regards
        --
        Willem Bogaerts

        Application smith
        Kratz B.V.

        Comment

        • Toby A Inkster

          #5
          Re: Run PHP scripts outside of the web directory

          Aggelos wrote:
          Is it possible to run a script that will be used from all the websites
          on the server outside of the web dir ?
          I'm not 100% sure what you're asking for, but it sounds to me like
          symbolic links might be the answer.

          Say you have three sites hosted on a server, example.com, example.org
          and... you guessed it... example.net. These are hosted in the following
          directories on the server:

          /var/www/vhosts/example.com/
          /var/www/vhosts/example.org/
          /var/www/vhosts/example.net/

          Now, you install some flashy-super-web-based-app into, say:

          /var/www/apps/FSWBA/

          and you want to make this available as:





          Then all you need to do is create three symbolic links, using the
          following commands at the command line:

          ln -s /var/www/apps/FSWBA/ /var/www/vhosts/example.com/FSWBA/
          ln -s /var/www/apps/FSWBA/ /var/www/vhosts/example.org/flashy/
          ln -s /var/www/apps/FSWBA/ /var/www/vhosts/example.net/flashy-app/

          And you're done. (Note: you may need to configure Apache to be able to
          follow symbolic links, as this ability is often disabled for security
          reasons.)

          --
          Toby A Inkster BSc (Hons) ARCS
          Contact Me ~ http://tobyinkster.co.uk/contact
          Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

          * = I'm getting there!

          Comment

          • Aggelos

            #6
            Re: Run PHP scripts outside of the web directory

            On Feb 13, 3:58 pm, Toby A Inkster <usenet200...@t obyinkster.co.u k>
            wrote:
            Aggelos wrote:
            Is it possible to run a script that will be used from all the websites
            on the server outside of the web dir ?
            >
            I'm not 100% sure what you're asking for, but it sounds to me like
            symbolic links might be the answer.
            I'll try symbolic links then.
            I haven't thought that and I believe is the best sollution.

            Comment

            • denis

              #7
              Re: Run PHP scripts outside of the web directory


              "Aggelos" <djjelly@gmail. comwrote in message
              news:1171374469 .796784.84640@a 34g2000cwb.goog legroups.com...
              Hello,
              Is it possible to run a script that will be used from all the websites
              on the server outside of the web dir ?
              At the moment for every site I have I upload the script in the web dir
              of the specific site...
              >
              Specifically it is a RichEditor so it has javascripts as well ...
              But it is difficult to maintain updates of the script to all websites
              so I would prefer if I had only one place to update it...
              >
              Any ideas will be appreciated.
              >
              Angelos.
              >

              I'm sure the other idea about symbolic links is fine, but couldn't you just
              put a small "shell" php file with something like

              <?php

              include ("/path/to/the/real/script");

              ?>

              anywhere you'd like to use the script? This way you change the script in one
              place and the includes in the shell file will reflect that in any
              application which uses it.

              I'm just saying that as you'd be able to avoid having to make symbolic links
              for every new app that uses your script.

              Denis Gerina


              Comment

              Working...