简体   繁体   English

Mountain Lion-更改配置文件(php.ini)路径

[英]Mountain Lion - Change configuration file (php.ini) path

I'm trying to get Symfony 1.4 running on my Mac. 我正在尝试在Mac上运行Symfony 1.4 When I type " ./symfony doctrine:build --all " to create the database, I receive the error " Couldn't located driver named mysql ". 当我输入“ ./symfony doctrine:build --all ”创建数据库时,收到错误消息“ Couldn't located driver named mysql ”。 I've searched for this error and I'm told I need to uncomment this extension in php.ini. 我已经搜索了此错误,并被告知需要在php.ini中取消注释此扩展名。 I have done this but I'm still getting the same error! 我已经做到了,但是我仍然遇到同样的错误!

When I type "php --ini" in terminal, I get: 在终端中输入“ php --ini”时,我得到:

Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File:         /usr/local/lib/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

I want to change this path so that is uses the php.ini in XAMPP. 我想更改此路径,以便在XAMPP中使用php.ini。

Any ideas on how to do this? 有关如何执行此操作的任何想法?

Use the PHP-binary inside your XAMP-Bundle. 在XAMP捆绑包内使用PHP二进制文件。 I would expect it to be located somewhere like /Applications/XAMPP.app/Contents/Ressources/php/bin/php . 我希望它位于/Applications/XAMPP.app/Contents/Ressources/php/bin/php地方。 But I can not verify this path currently. 但是我目前无法验证此路径。 So you might have to search inside the /Applications/XAMPP.app folder for it. 因此,您可能必须在/Applications/XAMPP.app文件夹中进行搜索。 Perhaps find /Applications/XAMPP.app -name php might help. 也许find /Applications/XAMPP.app -name php可能会有所帮助。

So you might want to add that path to your path file before calling the symfony-executable by setting PATH=/Applications/XAMPP.app/Contents/Ressources/php/bin:$PATH 因此,您可能希望通过设置PATH=/Applications/XAMPP.app/Contents/Ressources/php/bin:$PATH来在调用symfony可执行文件之前将该路径添加到路径文件中。

Thanks for your responses, but I managed to do what I set out to in the end... 感谢您的回复,但最终我还是按照我的意愿去做...

If you run "sudo pico /private/etc/paths" in Terminal, you can then add the path to php in XAMPP to the top of this file, which in my case was "/Applications/XAMPP/xamppfiles/bin". 如果在终端中运行“ sudo pico / private / etc / paths”,则可以将XAMPP中php的路径添加到此文件的顶部,在我的情况下为“ / Applications / XAMPP / xamppfiles / bin”。

If you then restart Terminal and run "which php", you will see the new path. 如果然后重新启动终端并运行“哪个php”,您将看到新路径。

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM