Alright so I've written a script for my job which uses CasperJS to grab a PDF and download it, then continue execution of the PHP script. I call this script using exec().
This works fine on my Windows 10 machine using XAMPP. However when I port it to my work laptop (a Macbook Pro running latest OSx) exec() will not work with casperJS. I can call phantomjs --version and casperjs --version from the terminal no problem, both were installed using node.js with the global flag. I've confirmed they are in usr/local/bin.
When I run exec("phantomjs --version", $output); It works fine and returns the phantomjs version.
When I run exec("casperjs --version", $output); It returns an empty array in output, rather than the version number.
I'm unsure why this is happening, and I've been googling and googling and no solutions. I found several topics here that had the same issues, and I implemented their solutions and it still won't work. My code for work is long and has a lot of information I can't share, but here is my test script I created to see if I could get around the issue.
I also want to specify that I am using XAMPP for Mac to run this, as I didn't want to take the time to setup a vagrant box, and setup the VPN stuff (that my script has to be run through) to run this script.
<?php
putenv("PHANTOMJS_EXECUTABLE=/usr/local/bin/phantomjs");
putenv("DYLD_LIBRARY_PATH");
putenv("PATH=/usr/local/bin");
exec("casperjs --version", $output);
print_r($output);
?>
I hate asking for help, but this script is going to take 2 more days to run, and because I have to be connected to the VPN, my primary computer I use for gaming, personal projects, etc is tied up and I'd LOVE to move this to my work laptop so that I can enjoy my personal computer this weekend.