There is a workaround for the lastest PhantomJS version. You can install PhantomJS on Ubuntu 22.04 LTS, see https://gist.github.com/julionc/7476620.
I used another version of PhantomJS, https://phantomjs.org/download.html (phantomjs-2.1.1-linux-x86_64.tar.bz2) but you can use the version of the thread.
To use the PhantomJS on Ubuntu 22.04 you have to install an OpenSSL Version 1.x in a different directory. Attention, DO NOT overwrite the OpenSSL of the system! This will mess up your system.
Remark: If you use the OpenSSL Version 1.x and the old PhantomJS (2016!) you should run the command as an unprivileged user.
Install PhantomJS as mentioned. If you run PhantomJS you get the following error:
Auto configuration failed
140398212290496:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libproviders.so): libproviders.so: cannot open shared object file: No such file or directory
Build your own OpenSSL in a subdirectory and connect phantomjs:
# All commands as unprivileged user, download the latest OpenSSL Version 1.x
cd $HOME
mkdir src
mkdir share
cd src
wget https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz
# Check SHA256 Sum
sha256sum openssl-1.1.1w.tar.gz # MUST MATCH!
tar xzf openssl-1.1.1w.tar.gz
cd openssl-1.1.1w/
You must know your os/compiler type to compile the openssl source. The possible os/compilers are in the documentation https://wiki.openssl.org/index.php/Compilation_and_Installation#Supported_Platforms or call ./Configure and read the output.
# My system is linux-x86_64
./Configure --prefix=$HOME/share/openssl-1.1.1 --openssldir=$HOME/share/openssl-1.1.1 linux-x86_64
make
make install
Now everything is in place, you can use the openssl version 1.x with this command:
# run as unprivileged user!
$ OPENSSL_CONF=$HOME/share/openssl-1.1.1 phantomjs --version
2.1.1
$ OPENSSL_CONF=$HOME/share/openssl-1.1.1 phantomjs --ignore-ssl-errors=true rasterize.js https://stackoverflow.com