使用安装在OSX狮子口的PHP模块。它的命令行工作,但不是来自Apache [英] Installing php-module using port on osx lion. It works from command line but not from apache

查看:198
本文介绍了使用安装在OSX狮子口的PHP模块。它的命令行工作,但不是来自Apache的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装PHP5,国际上的我的OSX的狮子。

这似乎在命令行模式下正常工作,因为如果我尝试运行以下脚本(1):

  $ FMT = datefmt_create(EN_US,IntlDateFormatter :: FULL,IntlDateFormatter :: FULL,美国/洛杉矶,IntlDateFormatter :: GREGORIAN);
回声首先格式化输出为.datefmt_format($ FMT,0)\\ N。


 > PHP -m | grep的国际
国际> PHP test.php的
首先格式化输出是星期三,1969年12月31日下午4时00分○○秒太平洋标准时间


但是,如果我试图太阳从我的Apache相同的(后须藤apachectl中重启)我收到以下错误:

 >尾/私营/无功/日志/的Apache2 / error_log中
PHP的致命错误:调用未定义的函数datefmt_create()的

P.S:

我还添加了下面一行到我的php.ini

 的extension_dir =/选择/ local / lib目录/ PHP /扩展/无调试非ZTS-20090626LL的/ opt / local / lib目录/ PHP /扩展/无调试非ZTS-20090626
共有848
-rwxr-XR-X 1根261712 5月7日10:54 xdebug.so
-rwxr-XR-X 1根168912 5月31日19时53 intl.so


在php.ini中写的是:加载配置文件 /private/etc/php.ini 这是文件我编辑。


这是我的配置的其他信息如下:

  /private/etc/apache2/httpd.conf
的LoadModule php5_module的libexec / apache2的/ libphp5.so
/usr/libexec/apache2/libphp5.so/private/etc/php.ini
下extension_dir =/选择/ local / lib目录/ PHP /扩展/无调试非ZTS-20090626


解决方案

创建一个网页,这些内容:

 < PHP
的phpinfo();
回声datefmt_create(EN_US,IntlDateFormatter :: FULL,IntlDateFormatter :: FULL);
?>

(是的,我知道,第二行给​​出了一个错误,但在这种情况下,它足以告诉我们,它的工作原理。)

查看该网页,并搜索国际支持或国际。在我来说,我看到:

 启用国际化支持
1.0.3版
ICU 4.2.1版本指令局部值主值
intl.default_locale没有价值没有价值
intl.error_level 0 0

如果你没有国际节present,那么它只能是一个php.ini的问题(更常见的原因是没有重新启动Apache的,但你说你会做到这一点)。

要确认,再次编辑php.ini文件,并在最后介绍你可以肯定将工作的变化。例如。 asp_tags = 1 。现在重新加载你的phpinfo()页面,并确保你看到的变化出现。

如果你不这样做或许是权限;运行Apache的用户无法读取php.ini文件?

I installed php5-intl on my osx lion.

It seems to work properly on command line mode because if I try to run the following script (1):

$fmt = datefmt_create( "en_US" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL,'America/Los_Angeles',IntlDateFormatter::GREGORIAN  );
echo "First Formatted output is ".datefmt_format( $fmt , 0)."\n";


> php -m |grep intl
intl

> php test.php 
First Formatted output is Wednesday, December 31, 1969 4:00:00 PM Pacific Standard Time


But if I try to sun the same from my apache (after sudo apachectl restart) I get the following error:

> tail /private/var/log/apache2/error_log
PHP Fatal error:  Call to undefined function datefmt_create() in

P.S.:

I also added the following line to my php.ini

extension_dir = "/opt/local/lib/php/extensions/no-debug-non-zts-20090626"

ll /opt/local/lib/php/extensions/no-debug-non-zts-20090626
total 848
-rwxr-xr-x  1 root  261712  7 May 10:54 xdebug.so
-rwxr-xr-x  1 root  168912 31 May 19:53 intl.so


in php.ini is written: Loaded Configuration File /private/etc/php.ini which is the file I edited.


Other info on my configuration are the following:

/private/etc/apache2/httpd.conf
LoadModule php5_module libexec/apache2/libphp5.so
/usr/libexec/apache2/libphp5.so

/private/etc/php.ini
extension_dir = "/opt/local/lib/php/extensions/no-debug-non-zts-20090626"

解决方案

Create a web page, with these contents:

<?php
phpinfo();
echo datefmt_create("en_US" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL);
?>

(Yes, I know that 2nd line gives an error, but in this case it is enough to tell us it works.)

View that web page, and search for "Internationalization support" or "intl". In my case I see:

Internationalization support    enabled
version                         1.0.3
ICU version                     4.2.1

Directive           Local Value Master Value
intl.default_locale no value    no value
intl.error_level    0           0

If you have no intl section present, then it can only be a php.ini issue (the more usual cause is not restarting apache, but you said you'd done that).

To confirm, edit the php.ini file again and at the very end introduce a change you can be sure will work. E.g. asp_tags = 1. Now reload your phpinfo() page and make sure you see the change there.

If you don't perhaps it is permissions; the user Apache runs as cannot read your php.ini file?

这篇关于使用安装在OSX狮子口的PHP模块。它的命令行工作,但不是来自Apache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆