Mac OS X 上的文件 php.ini 配置 [英] File php.ini configuration on Mac OS X

查看:48
本文介绍了Mac OS X 上的文件 php.ini 配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Mac OS X 上遇到了 PHP 配置文件 php.ini 的奇怪问题.我创建了一个 phpinfo 文件.在浏览器中调用它会显示 PHP 设置 -

I am experiencing a strange problem with PHP configurations file php.ini on Mac OS X. I have created a phpinfo file. Calling it in the browser shows the PHP settings with -

配置文件(php.ini)路径:/etc

Configuration File (php.ini) Path: /etc

加载的配置文件:/private/etc/php.ini

Loaded Configuration File: /private/etc/php.ini

但是,在此位置编辑 php.ini 文件(当然还需要重新启动 Apache)时,更改不会反映在 PHP 设置和 phpinfo 文件中.

However upon editing the php.ini file at this location, (and restarting Apache of course) the changes are not reflected in the PHP settings as well as the phpinfo file.

例如:更改 bcmath 十进制数字、更改时区设置等.Apache 是否可以从另一个主要位置获取设置文件?

E.g.: changing the bcmath decimal digits, changing timezone settings, etc. Is there another primary location from where Apache will pick up the settings file?

推荐答案

我使用带有 来自 josegonzales 的自制水龙头.

引用我的系统管理员朋友的话,答案应该在于重新启动 PHP-FPM 而不是 Apache.Apache 使用 mod_fastcgi 通过 PHP-FPM 运行 PHP 的端口或套接字连接到 PHP."

To quote my system administrator friend, "the answer should lie in restarting PHP-FPM instead of Apache. Apache uses mod_fastcgi to connect to PHP via a port or socket that PHP-FPM runs PHP with."

您需要加载/卸载与您的 PHP-FPM 关联的 p-list 文件安装.首先检查 ~/Library/LaunchAgents 不存在?我的位于这里:/usr/local/Cellar/php53/5.3.26/homebrew-php.josegonzalez.php53.plist

You need to load/unload the p-list file associated with your PHP-FPM install. First check ~/Library/LaunchAgents Not there? Mine was located here: /usr/local/Cellar/php53/5.3.26/homebrew-php.josegonzalez.php53.plist

它是这样重新启动的:

launchctl unload -w /usr/local/Cellar/php53/5.3.26/homebrew-php.josegonzalez.php53.plist && launchctl load -w /usr/local/Cellar/php53/5.3.26/homebrew-php.josegonzalez.php53.plist;

我将以下内容添加到我的 ~/.bash_profile 文件中,以便在重新启动 Apache 时可以重新启动 PHP-FPM.调用以下命令的命令是apachectlrestart"

I added the following to my ~/.bash_profile file so that I can restart PHP-FPM when I restart Apache. The command to invoke the following is "apachectlrestart"

function apachectlrestart () { sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist && sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist && launchctl unload -w /usr/local/Cellar/php53/5.3.26/homebrew-php.josegonzalez.php53.plist && launchctl load -w /usr/local/Cellar/php53/5.3.26/homebrew-php.josegonzalez.php53.plist;}

这是一个旧帖子,但我遇到了这个问题并在互联网上搜索无济于事,所以我在这里回答.

这篇关于Mac OS X 上的文件 php.ini 配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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