安装特定版本的mPDF

我正在尝试使用PHP 7.0.33在我的Centos服务器上安装mPDF并继续默认为mPDF版本6.1 。 我需要版本7或8.我尝试从github手动上传mPDF 8,但它会在编辑器中创建加密指纹问题。</ p>

有没有办法强制安装版本8或7?</ p>
</ div>

展开原文

原文

I am trying to install mPDF on my Centos server with PHP 7.0.33 and it continues to default to mPDF version 6.1. I need version 7 or 8. I tried manually uploading mPDF 8 from github but it creates a cryptographic fingerprint issue with composer.

Is there a way to force install version 8 or 7?

duangu1878
duangu1878 立即更新CLIPHP....
一年多之前 回复
dqwmhrxt68679
dqwmhrxt68679 哪个php别名php='/opt/plesk/php/7.0/bin/php'
一年多之前 回复
dongtou9934
dongtou9934 所以我安装了PHP7
一年多之前 回复
drd99007
drd99007 composer需要mpdf/mpdf:^8.0:[InvalidArgumentException]在版本^8.0中包mpdf/mpdf的PHP要求与PHP版本不兼容(5.4.16)
一年多之前 回复
doulie0178
doulie0178 php-v给出PHP7.0.33(cli)(内置:2018年12月7日12:52:03)(NTS)
一年多之前 回复
doudu2591
doudu2591 或者存在其他库版本的冲突。作曲家需要什么mpdf/mpdf:^8.0打印出来?
一年多之前 回复
duanchen7401
duanchen7401 你的cliPHP版真的是7.0.33吗?什么是php-v打印出来的?我猜你的cli<5.6
一年多之前 回复
doulao2128
doulao2128 我正在使用CodeIgniter3,不知道放在哪里,我猜想是third_party文件夹
一年多之前 回复
dongwei3120
dongwei3120 那还是把它放在作曲家的文件夹里。把它放在其他地方,手动加载。
一年多之前 回复
dongxixia6399
dongxixia6399 不要使用作曲家。
一年多之前 回复

1个回答

Here's what I ultimately had to do. Since 'composer require' runs at the command line it detects the CLI version of PHP, which is different from what apache might be using. I updated my CLI PHP to 7.0 with the following script:

https://github.com/dfuentes87/change_phpcli.sh/blob/master/change_phpcli.sh

cd ~/

touch change_phpcli.sh

vim change_phpcli.sh

(I just pasted the code in since it is a small file) save file then

chmod +x change_phpcli.sh

run the script ./change_phpcli.sh

and answer the question, I entered 7.0 for my version

Then run composer require mpdf/mpdf:^8.0

I also had to force my code to use a specific tmp folder for mPDF for some reason using:

require_once APPPATH . '../vendor/autoload.php';

$mpdf = new \Mpdf\Mpdf(['tempDir' => APPPATH . '../vendor/mpdf/mpdf/tmp/']);

and chown it to the user/group that run my web scripts:

chown myuser:psacln vendor/mpdf/mpdf/tmp/

Hope this helps, thanks for the pointers @Finwe

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐