5 Replies Latest reply on Aug 23, 2016 8:31 AM by deninger

    PHP, Scripts, and Full Access

    deninger

      I have a solution I am working on that is receiving data by JSON over a PHP connection. I am trying to execute a script after the data insert. I created a script to call the necessary scripts for processing, and designed it to run on the server using Perform Script on Server. This was done for two reasons:

      1. to allow the user to initiate the processing from the client as well. But when I call this script from PHP it fails to run. When I explicitly look at Get (Last Error) I am seeing 9 (Insufficient privileges to modify/access data.)
      2. prevent the URL from timing out as the script may take a few seconds to run...

       

      The account being used to upload the data by JSON file had limited privileges, but it DID have permission to execute all scripts and perform data entry on all necessary tables. When I expanded the privileges to the default of  Data Entry Only, the script goes further but still fails many of the subroutines. Expanding the privileges to Full Access, everything works perfectly.

       

      In a nutshell:

       

      Limited Privs, PSOS --> fails (Error 9)

      Limited Privs, PS --> URL times out and script fails completely

      Data Entry Only, PSPS or PS --> parts run, but generally fails, no error or times out

      Data Entry Only PS --> Works perfectly.

       

      Has anyone else seen something like this happen? I really don't want to grant full access to the account in question.

        • 1. Re: PHP, Scripts, and Full Access
          DavidJondreau

          How about granting the script full access privileges (as well as any subscripts)?

           

          I would be reluctant to use PSOS from a CWP-initiated script. Instead, I would have two scripts. The script itself, called by CWP, and another that calls it using PSOS (for FMP clients). You could, of course, combine this into one script using If[] to direct the script calling.

           

          Do you have Allow User Abort[Off]? That may handle the time out issue.

           

          You can do some robust error checking (after each step that could trigger an error, check and log).

          • 2. Re: PHP, Scripts, and Full Access
            deninger

            My first thought was to grant all of the scripts and sub-scripts full access privileges. That did not change anything.  I have tried turning Allow User Abort[off] and that does not work. Whenever I kick off the script normally (not PSOS), it hangs the browser and fails to return. Running with PSOS, it does not hang.

             

            I have done extensive data logging with error checking. The errors I am seeing are related to privileges. Granting anything short of FULL ACCESS to the CWP user fails.

             

            The scripts in question are not very complex, either. They parse the data inserted in the CWP interface (JSON packages) and create the appropriate records in several tables.

            • 3. Re: PHP, Scripts, and Full Access
              deninger

              Followup: It looks like my scripts that are initiated through custom web publishing require, for whatever reason, Access via FileMaker Network (fmapp) enabled in order to work. Any rhyme or reason for this?

              • 4. Re: PHP, Scripts, and Full Access
                DavidJondreau

                Is there more than one file involved here? Are there External Data Sources?

                • 5. Re: PHP, Scripts, and Full Access
                  deninger

                  No, only one file involved. At least I can minimize the exposure to something less than [Full Access] until I figure out why...