Search code examples
phpherokuironworker

PHP Required Files Iron Worker


I am uploading a .worker file to ironworker. The worker's code requires (with the require command) other php files. Do I need to upload them too to ironworker?

In other words, do I need to add something else to the .worker file and how:

# define the runtime language
runtime "php"
# exec is the file that will be executed:
exec "hello.php"

WHERE: hello.php would contain this statement:

require_once 'bye.php';

Solution

  • Yes. IronWorker runs on Iron.io's servers, so all dependencies need to be uploaded.

    You can do this in the worker file by using the dir and file commands:

    dir 'path/to/dir'
    file 'path/to/file.php'
    

    Dir will include entire directories, file will include only a single file. You can find out more information on the .worker reference page.