标签:dex profile cal pre off exec java环境变量 load 解压
原文地址:http://www.niu12.com/article/15
$ sudo mv jdk-8u201-linux-x64.tar.gz /usr/local/
解压文件
$ sudo tar -zxvf /usr/local/jdk-8u201-linux-x64.tar.gz
$ sudo vim /etc/profile
#在文件的最后添加如下内容
#Java Env
export JAVA_HOME=/usr/local/jdk1.8.0_201
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
#生效环境变量
$ source /etc/profile
#测试java环境
$ sudo java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
$ sudo mv Apache_OpenOffice_4.1.6_Linux_x86-64_install-deb_zh-CN.tar.gz /usr/local/
#解压文件
$ sudo tar -zxvf /usr/local/Apache_OpenOffice_4.1.6_Linux_x86-64_install-deb_zh-CN.tar.gz
#这个时候会生成zh-CN文件
#重命名
$ sudo mv ./zh-CN/ ./openOffice
$ cd openOffice
$ sudo dpkg -i *.deb
$ cd desktop-integration/
$ sudo dpkg -i openoffice4.1-debian-menus_4.1.6-9790_all.deb
#这个时候openoffice安装在/opt/openoffice4
$ cd /opt
wget https://downloads.sourceforge.net/project/jodconverter/JODConverter/2.2.2/jodconverter-2.2.2.zip
#解压
$ unzip /opt/jodconverter-2.2.2.zip
#进入目录
cd /opt/jodconverter-2.2.2/lib
#进入jdk字体目录
$ cd /usr/local/jdk1.8.0_201/jre/lib/fonts/
# 建立fallback目录
$ mkdir fallback
# 将中文字体msyh.ttf、msyhbd.ttf、simhei.ttf、simsun.ttc放到fallback目录下
#将字体放到linux字体文件夹
$ cp /usr/local/jdk1.8.0_201/jre/lib/fonts/fallback/* /usr/share/fonts/
$ cp /usr/local/jdk1.8.0_201/jre/lib/fonts/* /usr/share/fonts/
#刷新字体缓存
fc-cache
$ soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &
#将tmp目录下的test.docx转换成test.pdf
$ sudo java -jar /opt/jodconverter-2.2.2/lib/jodconverter-cli-2.2.2.jar /tmp/test.docx /tmp/test.pdf
$ ps -ef|grep soffice
$ kill -9 30415
#需要修改php.ini文件,因为使用了disable_function exec()
#需要java的完全路径
<?php
$command = "sudo /usr/local/jdk1.8.0_201/bin/java -jar /opt/jodconverter-2.2.2/lib/jodconverter-cli-2.2.2.jar /tmp/test.docx /tmp/test.pdf";
// $return_var返回值0或1,如果返回0则执行成功,返回1则执行失败
exec($command, $output, $return_var);
if ($return_var != 0) {
throw new \Exception("生成PDF失败");
}
标签:dex profile cal pre off exec java环境变量 load 解压
原文地址:https://www.cnblogs.com/zhouqi666/p/10340838.html