1 year ago
#316337
Roohome Com
PhantomJS Working on Server but Not XAMPP
I have problem with phantomJS at XAMPP(Installed) MAC. Last time, I am using XAMPP-VM (for Mac) but since update to Monterey. It does not work. I have problem with a new environment here. When trying to run PhantomJS from PHP. It shows
Fatal error: Uncaught JonnyW\PhantomJs\Exception\NotWritableException: File could not be written to system as target is not writable: /var/folders/gd/6f7z77vj3ps0lvnyj88pxg_40000gn/T/b17136c6c91e8bb1fc7b in /Applications/XAMPP/xamppfiles/htdocs/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Cache/FileCache.php:65 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Procedure/Procedure.php(188): JonnyW\PhantomJs\Cache\FileCache->save('b17136c6c91e8bb...', '\n(function(W,K)...') #1 /Applications/XAMPP/xamppfiles/htdocs/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Procedure/Procedure.php(98): JonnyW\PhantomJs\Procedure\Procedure->write('\n(function(W,K)...') #2 /Applications/XAMPP/xamppfiles/htdocs/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Procedure/ProcedureValidator.php(84): JonnyW\PhantomJs\Procedure\Procedure->run(Object(JonnyW\PhantomJs\Procedure\Input), Object(JonnyW\PhantomJs\Procedure\Output)) #3 /Applications/XAMPP/xamppfiles/htdocs/vendor/jonnyw/php-pha in /Applications/XAMPP/xamppfiles/htdocs/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Cache/FileCache.php on line 65
Here is the code
$client = Client::getInstance();
$client->getEngine()->setPath($_SERVER["DOCUMENT_ROOT"].'/bin/phantomjs');
$client->getEngine()->addOption('--cookies-file=' . $cookies);
$request = $client->getMessageFactory()->createRequest($url, 'GET');
$request->addSetting('userAgent', $userAgent);
$response = $client->getMessageFactory()->createResponse();
Things I have done.
- Changing permission to 777 (for bin & the files inside it) (For Test Purpose)
- Installing phantomJS on my Mac
php
phantomjs
0 Answers
Your Answer