Imagick安装但没有从apache加载?

我有点困惑。 如果我运行一个脚本,它既可以从php内置服务器也可以从控制台运行。</ p>

  $ img = new Imagick(); 
var_dump($ img);
</ code> </ pre>

但如果我运行</ p>

 &lt;?php phpinfo(); 
</ code> </ pre >

Apache看不到想象力。 我在Symfony应用程序中使用它,有时会返回此错误日志:</ p>


[2016-10-27 12:03:30] request.CRITICAL:未捕获的PHP Exception Symfony \ Component \ Debug \ Exception \ ClassNotFoundException:“试图从全局命名空间加载类”Imagick“。你忘了”使用“语句吗?” at /Volumes/Sviluppo/bitbucket.org/.../.../vendor/imagine/imagine/lib/Imagine/Imagick/Imagine.php第39行{“exception”:“[object](Symfony \ Component \ \ Debug \ Exception \ ClassNotFoundException(code:0):尝试从全局命名空间加载类\“Imagick \”。
你忘记了一个\“use \”语句吗?at /Volumes/Sviluppo/bitbucket.org/ ... / ... / vendor / imagine / imagine / lib / Imagine / Imagick / Imagine.php:39)“} []
</ code> </ p>

我想知道 imagick.ini文件</ p>

  $ php -i |  grep ini |  grep ima 
解析附加的.ini文件=&gt; /usr/local/etc/php/7.0/conf.d/ext-imagick.ini,

nn

包含</ p>

  $ cat /usr/local/etc/php/7.0/conf.d/ext-imagick.ini
[imagick]
extension="/usr/local/opt/php70-imagick/imagick.so“

</ code> </ pre>

文件存在!!! </ p>

来自cli的PHP版本</ p>

 < 代码> $ php -v 
PHP 7.0.12(cli)(建于2016年10月14日09:55:03)(NTS)
版权所有(c)1997-2016 PHP Group
Zend Engine v3.0.0,版权所有(c )1998-2016 Zend Technologies
与Xdebug v2.4.1,版权所有(c)2002-2016,作者:Derick Rethans
</ code> </ pre>

phpinfo()< / code> show me 7.0.11。</ p>

最后,...配置加载是php5配置。 大声笑。 如何将我的所有php移动到相同版本?</ p>

</ p>
</ div>

展开原文

原文

I am a bit confused. If I run a script it works both from php-built-in server and from console.

$img = new Imagick();
var_dump($img);

But if I run

<?php phpinfo();

Apache do not see imagick. I use it in a Symfony application that sometimes return this error log:

[2016-10-27 12:03:30] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\ClassNotFoundException: "Attempted to load class "Imagick" from the global namespace. Did you forget a "use" statement?" at /Volumes/Sviluppo/bitbucket.org/.../.../vendor/imagine/imagine/lib/Imagine/Imagick/Imagine.php line 39 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ClassNotFoundException(code: 0): Attempted to load class \"Imagick\" from the global namespace. Did you forget a \"use\" statement? at /Volumes/Sviluppo/bitbucket.org/.../.../vendor/imagine/imagine/lib/Imagine/Imagick/Imagine.php:39)"} []

I wondered in imagick.ini file

$ php -i | grep ini | grep ima
Additional .ini files parsed => /usr/local/etc/php/7.0/conf.d/ext-imagick.ini,

that contains

$ cat /usr/local/etc/php/7.0/conf.d/ext-imagick.ini
[imagick]
extension="/usr/local/opt/php70-imagick/imagick.so"

File exists!!!

PHP Version from cli is

$ php -v
PHP 7.0.12 (cli) (built: Oct 14 2016 09:55:03) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans

But phpinfo() show me 7.0.11.

Finally, ... configuration loaded is php5 configuration. LOL. How can I move all my php to the same version?

phpinfo output

1个回答



为什么命令行上的php -v仍显示旧版本?</ strong> </ p>


php-osx不会覆盖Apple安装的php二进制文件,但
会安装/ usr / local / php5中的所有内容。 新的php二进制文件是
因此在/usr/local/php5/bin/php.



nn

你也可以调整你的PATH包括那个目录,例如。 将〜/ .profile文件写入以下</ p>

  export PATH = / usr / local / php5 / bin:$ PATH 
</ code> </ pre>

包含的扩展名</ strong> </ p>


bcmath bz2 calendar核心ctype curl date dom dtrace ereg exif fileinfo
filter ftp gd gettext hash iconv imap intl json ldap libxml mbstring
mcrypt memcache memcached mhash mongo mssql mysql mysqli mysqlnd OAuth
odbc openssl pcntl pcre PDO pdo_dblib pdo_mysql pdo_pgsql pdo_sqlite
pgsql Phar posix反射会话shmop SimpleXML soap套接字solr
SPL SQLite sqlite3标准sysvmsg sysvsem sysvshm tidy tokenizer
wddx xdebug xhprof xml xmlreader xmlrpc xmlwriter xsl zip zlib Xdebug </ p>

可用但默认情况下禁用:apc,xslcache,twig,uploadprogress </ p>
</ blockquote> \ n

请仔细阅读文档@ https://php-osx.liip.ch/ </ p>
</ div>

展开原文

原文

Why does php -v on the command line still show my old version?

php-osx doesn't overwrite the php binaries installed by Apple, but installs everything in /usr/local/php5. The new php binary is therefore in /usr/local/php5/bin/php.

You can also adjust your PATH do include that directory, eg. write into your ~/.profile file the following

export PATH=/usr/local/php5/bin:$PATH

Included extensions

bcmath bz2 calendar Core ctype curl date dom dtrace ereg exif fileinfo filter ftp gd gettext hash iconv imap intl json ldap libxml mbstring mcrypt memcache memcached mhash mongo mssql mysql mysqli mysqlnd OAuth odbc openssl pcntl pcre PDO pdo_dblib pdo_mysql pdo_pgsql pdo_sqlite pgsql Phar posix Reflection session shmop SimpleXML soap sockets solr SPL SQLite sqlite3 standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xdebug xhprof xml xmlreader xmlrpc xmlwriter xsl zip zlib Xdebug

available but disabled by default: apc, xslcache, twig, uploadprogress

Consider reading the documentation @ https://php-osx.liip.ch/

dougua3705
dougua3705 你想要两个版本的php,如果你现在不使用php-osx(旧的那个)可以卸载它。 如果要创建导出路径,可以通过触摸〜/ .profile创建它,然后编辑它并包含导出。 如果你已经有〜/ .bash_profile,你也可以把它放在那里。
接近 4 年之前 回复
drm16022
drm16022 我没有〜/ .profile文件。
接近 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐