Im running a self hosted version of Invoice ninja and i want to use local phantomJs. I have tried to use the cloud version but have had no luck so am resorting to local generation.
Here is a little more info after running the test script…
root@HHP-01:/var/www/invoiceninja# phantomjs test.pjs
QXcbConnection: Could not connect to display
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.
Aborted
It’s a stand-alone, precompiled binary of PhantomJS 2.1.1 built specifically for the ARM CPU on the Pi. Just make sure you assign it the right permissions for it to be executable system-wide.
i installed phantomjs via apt-get, so i can see why this is an issue now. Would you be able to give me some instructions on how to install the file in your link? i took a look at the readme and couldnt find any helpful information.
I am slowly getting back into the coding side of things, ive always been in touch with it but ive had a few years away so having to learn it again so please bear with me.
No problem. Just keep in mind I haven’t tested this yet, so no guarantees (the only Pi in my house right now is a Plex client in my home theater setup).
Before downloading the file, make sure you use sudo apt purge phantomjs to get rid of all traces of the current install, including any dependencies that might not be needed (IIRC, the apt version installs a bunch of GUI related garbage that's not necessary).
<li>If you click the download link, it should just give you the file itself labelled <code>phantomjs</code>. There's no extension, but that's not needed anyway.</li>
<li>Drop that file into <code>/usr/bin</code> (easiest way, since that directory is in the <code>$PATH</code> variable for every user on a system).</li>
<li>Once there, it's best to assign ownership to root. You can do this with <code>sudo chown root:root /usr/bin/phantomjs</code></li>
<li>Next, make sure it has the right permissions with <code>sudo chmod 775 /usr/bin/phantomjs</code></ul></li>
Then it’s ready to go. Just make sure your .env file has PHANTOMJS_BIN_PATH=/usr/bin/phantomjs in it.
Other than PhantomJS no longer crashing, I’m unfortunately out of my depth on this one.
Possibly a dumb question, but did you have PHANTOMJS_SECRET set in your .env file? The one you pasted had other keys and such redacted, but it looked like that entry was completely blank.
So it would appear PhantomJS is doing what it’s supposed to, and it’s the server itself having an issue. The only other thing I can think of is to check the KeepAliveTimeout setting in your Apache config (assuming you’re using Apache and not nginx, obviously).
Might be a long-shot, but take a look in /etc/apache2/apache.conf. Look at the entries for KeepAlive, MaxKeepAliveRequests, and KeepAliveTimeout. They’re probably fine, but couldn’t hurt to check them anyway.
Another dumb question, but did you restart Apache after making changes?
Regardless though, the settings you posted are the same ones I have (and those are default, I believe), so the problem is definitely elsewhere. Where, however, is unfortunately out of my wheelhouse. Wish I could be more help, but I’m just as stumped as you are at this point.
Yeah i restarted apache, its fully updated etc, this is killing me. im boarderline passing it off and finding another invoice platform. its a shame as there is not a lot of information on the web for this fault either
I setup an Invoice Ninja install on my RPi trying to figure out what’s going on. The good news is that I’m able to replicate the issue. The bad news is I’m nowhere closer to figuring it out. I’ve tried removing the password requirement and eliminating the PhantomJS secret in .env, I’ve tried disabling IPv6, etc., and I’m still scratching my head.
Starting to wonder if it might be a strange issue with the ARM build in general, since I don’t have any trouble on my actual production server that runs on an x86_64 system.
Just for kicks (if you have the time and inclination), try setting up a VM on an Intel/AMD-powered system and installing IN on that.
Thanks for putting in the time and looking into the same issue im having. I do have a server with digital ocean (ubuntu) which i could install IN on but i wanted to run it on my Pi at home as the server in the cloud is for a seperate business, i guess i could run it on that server but wanted to keep them seperate and have my invoicing system for my Heating and plumbing company at home.
Have you managed to look into it any further? as i feel like im getting no where with it and defeated.
Chased a wild thought and wondered if there was some difference between the zip file install and the composer install, so I started over and tried both. Same problem each time. And whether using the cloud or local phantomjs, I get back “Failed to load PDF document” when I hit the test button.
Additionally, just before that’s going on, I see production.ERROR: TypeError: Attempting to change value of a readonly property. several times in laravel-error.log (tested with a blank log file, so this error is definitely related).
There seems to be a similar thread from last year, but unlike that thread, I have no issues viewing or downloading the PDF file. It’s only when phantomjs is involved that the problem happens.
Basically just posting to hopefully give the @hillel and the crew more information to go on. I’m at the end of my abilities, especially since I have zero issues on my production install.