Php-phantomjs: how to enable disk cache

Although phantomjs has a parameter disk-cache

that works when run through the command line, when I use php-phantomjs no disk caching is generated.
Is there any specific parameter I have to set on PHP or Apache for php-phantomjs to use disk-cache?

+3


source to share


1 answer


I think I found out how to answer my own question:

  • Make sure the custom Apache site is writable by the user running Apache, or at least this one $HOME/.qws

    is writable by that user.
  • Set environment variable $HOME

    to PHP script:
    $apacheUserData = posix_getpwuid(posix_getuid()); putenv('HOME='.$apacheUserData['dir']);



With the steps above, phantomjs

binary run from PHP knows how to find the user's Apache directory and also knows how to write in $HOME/.qws

.

+1


source







All Articles