Pls try one of these solutions and let us know the result:
1 . Add the following to your /etc/apt/sources.list:
# old packages from Focal deprecated in 22.04:
deb http://archive.ubuntu.com/ubuntu focal main universe multiverse restricted
Then run the following:
$ sudo apt update
$ sudo apt install phantomjs
$ phantomjs --version
2.1.1
Lastly, comment out the focal source in your /etc/apt/sources.list:
# old packages from Focal deprecated in 22.04:
#deb http://archive.ubuntu.com/ubuntu focal main universe multiverse restricted
source: https://github.com/actions/runner-images/issues/6727
2 . Disable OpenSSL 3 configuration loading by running it as:
OPENSSL_CONF= bin/phantomjs
source: https://stackoverflow.com/questions/75084538/failed-to-install-phantonjs-2-1-1-linux-x86-64-on-ubuntu-22-04-1-lts
3 . To install PhantomJS on Ubuntu 22.10, you can follow these steps:
Update your system packages with sudo apt update && sudo apt upgrade
Install the required packages with sudo apt install build-essential chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev
Download the PhantomJS binary file from its official website with wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
Extract the file to /usr/local/share/ with sudo tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /usr/local/share/
Create a symbolic link to the binary file with sudo ln -sf /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin
Verify the installation with phantomjs --version
source: https://shafiq.in/blog/how-to-install-phantomjs-on-ubuntu-22.10/