[英]PHP Gnupg is not showing up as an extension in phpinfo() and I can't use it in php
I have gnupg and gpgme installed using homebrew. 我使用自制软件安装了gnupg和gpgme。 I also linked both and made sure they are installed and linked by running brew gnupg install and brew gpgme install and got the message confirming the installation and the version.
我还链接了这两个文件,并通过运行brew gnupg install和brew gpgme install来确保它们已安装并链接,并得到确认安装和版本的消息。
I have placed the gnupg.so file in the extension path and also added extension=gnupg.so into the php.ini file. 我已经将gnupg.so文件放在扩展路径中,并且还将extension = gnupg.so添加到了php.ini文件中。
I got the extension path and the specific php.ini's path from the infophp page. 我从infophp页面获得了扩展路径和特定php.ini的路径。 After restarting mamp, I still don't see gnupg or gpgme as extensions on phpinfo, neither I can use gnupg in my php code.
重新启动Mamp之后,我仍然看不到gnupg或gpgme作为phpinfo的扩展,我也不能在我的php代码中使用gnupg。
using $gpg = new \\gnupg();
使用
$gpg = new \\gnupg();
this gives me error saying gnupg class doesn't exist. 这给我一个错误,说gnupg类不存在。
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'gnupg' not found
I tried another approach: I also manually downloaded both gnupg and gpgme from their website extracted them ran following 我尝试了另一种方法:我还从他们的网站上手动下载了gnupg和gpgme,并提取了以下内容
./configure, 。/配置,
make, 使,
sudo make install, sudo make install,
and was able to install successfully again, also made sure that gnupg.so is in the same path that shows up in phpinfo page for extension path and also added extension=gnupg.so
to the same php.ini that appears in phpinfo page (I added the extension=gnupg.so right after all the other extensions in the php.ini file) 并且能够再次成功安装,还请确保gnupg.so与phpinfo页面中显示的扩展路径相同,并且还将
extension=gnupg.so
添加到了phpinfo页面中显示的同一php.ini中(我在php.ini文件中的所有其他扩展名之后添加了extension = gnupg.so)
I am using: 我在用:
mac os high sierra 10.13.3 Mac OS High Sierra 10.13.3
php 7.1.12 PHP 7.1.12
mamp 4.4.1 模板4.4.1
gnupg 2.2.5 (I tried this version with brew install) gnupg 2.2.5(我使用brew install尝试了此版本)
gnupg 1.4.0 (I tried this version with downloading from gnupg.org) gnupg 1.4.0(我尝试从gnupg.org下载此版本)
gpgme 1.10.0 gpgme 1.10.0
I also would like to know, after hopefully fixing the above mentioned problems, do I need to include anything in my php file in order to use gnupg? 我也想知道,在希望解决上述问题后,我是否需要在php文件中包含任何内容才能使用gnupg?
what are the differences between gnupg and gpgme? gnupg和gpgme有什么区别? do I need both in order to encrypt a file in php?
我是否都需要为了在php中加密文件?
if I wasn't able to fix this what is another way to encrypt xml files or files containing text data? 如果我无法解决此问题,还有什么方法可以加密xml文件或包含文本数据的文件? I need to encrypt the file and FTP to another server and decrypt it over there.
我需要加密文件和FTP到另一台服务器,然后在那儿解密。
Thank you all in advance for your help 预先感谢大家的帮助
I was able to solve this issue using Pecl to install GnuPG. 我能够使用Pecl安装GnuPG来解决此问题。 This link helped me a lot as well.
该链接对我也有很大帮助。
Run the following in order to install the library: 运行以下命令以安装库:
Now Verify that it all went well with the following command: 现在,使用以下命令验证是否一切正常:
If everything is working as expected you'll see something like this: 如果一切正常,您将看到以下内容:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.