Weird registy problem in php script

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

    Weird registy problem in php script

    Hi everybody,

    I have the following setup:
    - Windows XP Pro with SP2 and all updates installed
    - Apache 2.054
    - PHP 4.4.x (not sure if 1 or 2)

    My app consists in a html form page which sends its content to a php script.
    The php script then runs an external process using exec (or passthru). This
    is where the problems start.

    This process reads some information stored in the registry. When I run it
    directly from the command line, this process works fine and the info gets
    retrieved from the registry. When I run it from the php script though, it
    fails somewhere in the registry access code, and I'm not sure whether it is
    an Apache or php issue.

    Could it be that some php (or maybe apache) security settings that are
    inherited by my process forbid registry access?

    I would really appreciate any ideas that will help me solve this issue.

    Thanks,

    A


  • Chung Leong

    #2
    Re: Weird registy problem in php script


    a wrote:[color=blue]
    > Hi everybody,
    >
    > I have the following setup:
    > - Windows XP Pro with SP2 and all updates installed
    > - Apache 2.054
    > - PHP 4.4.x (not sure if 1 or 2)
    >
    > My app consists in a html form page which sends its content to a php script.
    > The php script then runs an external process using exec (or passthru). This
    > is where the problems start.
    >
    > This process reads some information stored in the registry. When I run it
    > directly from the command line, this process works fine and the info gets
    > retrieved from the registry. When I run it from the php script though, it
    > fails somewhere in the registry access code, and I'm not sure whether it is
    > an Apache or php issue.
    >
    > Could it be that some php (or maybe apache) security settings that are
    > inherited by my process forbid registry access?
    >
    > I would really appreciate any ideas that will help me solve this issue.
    >
    > Thanks,
    >
    > A[/color]

    What's the path to the registery key? The HKEY_CURRENT_US ER hive is
    specific to the current logged-in user. The one that you have is going
    to be different from the one the web-server has.

    Comment

    • a

      #3
      Re: Weird registy problem in php script

      Thanks for replying.
      [color=blue]
      >
      > What's the path to the registery key? The HKEY_CURRENT_US ER hive is
      > specific to the current logged-in user.[/color]

      The path is HKEY_CURRENT_US ER\Software\...

      [color=blue]
      > The one that you have is going
      > to be different from the one the web-server has.
      >[/color]

      Could you please clarify this - I am not sure I understand what you mean.

      I don't know if this is relevant, but the external application is supposed
      to read some registry values that are also set externally, and not by the
      php script. The php script passes information to the process via the command
      line and eventually files on disk, but not through the registry.

      A


      Comment

      • Michael Austin

        #4
        Re: Weird registy problem in php script

        a wrote:
        [color=blue]
        > Thanks for replying.
        >
        >[color=green]
        >>What's the path to the registery key? The HKEY_CURRENT_US ER hive is
        >>specific to the current logged-in user.[/color]
        >
        >
        > The path is HKEY_CURRENT_US ER\Software\...
        >
        >
        >[color=green]
        >>The one that you have is going
        >>to be different from the one the web-server has.
        >>[/color]
        > Could you please clarify this - I am not sure I understand what you mean.[/color]

        In the context of the web-server "service", it runs as username SYSTEM or
        [someotheruser] and is therefore not you. I would personnally stay away from
        anything like this that is specific to one platform.. what if you want to move
        this to a REAL O/S - your registry stuff would break. Build it using a MySQL
        database or even an XML data file so you can move it to any platform - and
        would be much simpler to manage.
        [color=blue]
        >
        > I don't know if this is relevant, but the external application is supposed
        > to read some registry values that are also set externally, and not by the
        > php script. The php script passes information to the process via the command
        > line and eventually files on disk, but not through the registry.
        >
        > A
        >
        >[/color]


        --
        Michael Austin.
        Consultant

        Comment

        • a

          #5
          Re: Weird registy problem in php script

          >[color=blue]
          > In the context of the web-server "service", it runs as username SYSTEM or
          > [someotheruser] and is therefore not you. I would personnally stay away
          > from anything like this that is specific to one platform.. what if you
          > want to move this to a REAL O/S - your registry stuff would break. Build
          > it using a MySQL database or even an XML data file so you can move it to
          > any platform - and would be much simpler to manage.
          >[/color]

          I get it now. You are right about the OS specific issue, and I am actually
          working on a slightly different implementation that doesn't depend on the
          registry.

          Thanks for clarifying this for me.

          A


          Comment

          Working...