Although phantomjs has a disk-cache option that works when running via command line, when I use php-phantomjs no disk caching is created.
Is there any specific setting I should set on PHP or Apache so that php-phantomjs uses disk-cache?
1 Answer
Think I found out how to answer my own question:
- Make sure that Apache user's home is writable by the user running Apache, or at least that
$HOME/.qwsis writable by that user. - Set
$HOMEenviroment variable on PHP script:
$apacheUserData = posix_getpwuid(posix_getuid()); putenv('HOME='.$apacheUserData['dir']);
With the above steps phantomjs binary running from PHP knows how to find Apache's user dir and is also able to write to $HOME/.qws.