我之前写过一篇《SptingBoot基于Echarts生成折线图,柱状图》的文章,不过是基于windows环境的使用与运行的,那Linux环境应该怎么使用Phantomjs呢?
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 】下载Linux64的压缩包
tar -xvf phantomjs-2.1.1-linux-x86_64.tar.bz2

sudo ln -s /phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/bin/phantomjs
phantomjs -h 如果你发现报错了 (没有报错请跳过)root@ai:/home/ai# phantomjs -h
Auto configuration failed
140454038030272: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
140454038030272:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:
140454038030272:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=providers, path=providers
140454038030272:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=providers
这个问题是因为Ubuntu 22.04 使用新的 OpenSSL 版本 3.0.2 而不是旧的 OpenSSL 版本 1.1.1 。这些 OpenSSL 版本不完全向后兼容,所以这就是为什么您在 PhantomJS 尝试自动配置 SSL/TLS 设置时看到此错误的原因。
export OPENSSL_CONF=/dev/null
再次运行phantomjs -h,就恢复正常
root@ai:/home/ai# phantomjs -h
Usage:
phantomjs [switchs] [options] [script] [argument [argument [...]]]
Options:
--cookies-file= Sets the file name to store the persistent cookies
--config= Specifies JSON-formatted configuration file
--debug= Prints additional warning and debug message: 'true' or 'false' (default)
--disk-cache= Enables disk cache: 'true' or 'false' (default)
--disk-cache-path= Specifies the location for the disk cache
。。。。。
phantomjs /phantomjs-2.1.1-linux-x86_64/examples/hello.jsroot@ai:/# phantomjs /phantomjs-2.1.1-linux-x86_64/examples/hello.js
Hello, world!
输出Hello, world!代表phantomjs 安装成功