PHP:找不到类"Phar"
问题说明
我尝试将Silex框架用作Web应用程序的基础.但是,如果尝试包含* .phar存档,PHP会引发以下错误:
I try to use the Silex framework as base for my web application. However, if I try to include the *.phar archive, PHP throws the following error:
Fatal error: Class 'Phar' not found in /var/www/framework/silex.phar on line 11
以下相关行在我的/etc/php/php.ini
中(如Silex的文档中所建议):
The following relevant lines are in my /etc/php/php.ini
(as suggested in the docs of Silex):
extension=phar.so
phar.readonly = Off
phar.require_hash = Off
detect_unicode = Off
PHAR库位于/usr/lib/php/modules/phar.so
中,该库设置为我的php.ini
The PHAR library is present in /usr/lib/php/modules/phar.so
which is set as the extension path for all libraries in my php.ini
有人知道为什么PHP会引发此错误吗?
Does anyone know why PHP is throwing this error?
正确答案
尝试指定扩展名的路径:
php -d extension=phar.so composer.phar <your_script>
其他选项:
根据您提供的信息,有几种可能性:
Based on the information you provided, there are a few possibilities:
-
您正在使用其他php.ini.检查
phpinfo()
的输出进行确认,并确保您正在编辑活动目录.
-
You are using a different php.ini. Check the output of
phpinfo()
to confirm, and ensure that you are editing the active one.
/usr/lib/php/modules/phar.so不可读.确保Web服务器用户可以读取此文件.
/usr/lib/php/modules/phar.so is not readable. Ensure that the web server user can read this file.
自从您上次将与phar相关的信息添加到php.ini中以来,您的Web服务器尚未重新启动.重新启动您的网络服务器.
Your web server has not been restarted since you last added the phar-related information to php.ini. Restart your webserver.
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcfiebe
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20