1

I have a tedious setup and have ended up with multiple versions of PHP on Mac OSX Yosemite, and now it has become confusing. So, I managed to have gettext working with PHP for localization, and it works for Apache. But now when I have installed PHPStorm, I get:

Call to undefined function bindtextdomain()

indicating the gettext isn't supported. I understand that php.ini is also telling this isn't enabled and infact, there are different phpinfo() outputs for when I run the same file using apache and then using built-in server with PHPStorm.

Is there a way to be able to know which PHP is currently being used by apache and replicate the exact functionality with PHPStorm ? I wished that it will make debugging faster, but instead the setup has me stuck.

Nikhil Khullar
  • 703
  • 6
  • 21
  • 1
    Where do you get that message? Is it produced when executing script .. or message is in editor when editing php file? If first -- what it has to do with PhpStorm? It only uses that PHP installation which you telling it to use. If second -- PhpStorm may simply do not know anything about `gettext` functions and just informs you about it -- it does not mean that it will not work. – LazyOne Jan 21 '15 at 11:34
  • 1
    You can completely configure the php and ini used by PHPStorm in it's Run Configuration. Set it to use the one from apache and you are good. – ToBe Jan 21 '15 at 12:55
  • @LazyOne I see it when I try to run it in the browser via PHPStorm. – Nikhil Khullar Jan 21 '15 at 14:50
  • @ToBe Is there a way to find out which PHP is being used by Apache ? I tried looking in the httpd.conf but couldn't find any relevant information. – Nikhil Khullar Jan 21 '15 at 14:50
  • On Linux/Mac some distros may use separate config files (php.ini or whatever) for different environments: CLI and web. Just write a script with ` phpinfo();` and execute it -- it will tell you all details: what config it uses, what extensions are loaded and what settings are. – LazyOne Jan 21 '15 at 15:13
  • I did that already. But, it only affects the case when I use PHPStorm to run it as a command-line script. Because of some fast cgi support, when I run it via PHPStorm in a browser (Chrome) I get a different PHP version and a phpInfo which suggests gettext isn't loaded, and hence the fatal error. :( – Nikhil Khullar Jan 21 '15 at 15:50
  • I can't find the config for my apache2's php to use, but you should really be able to make it work by using `phpinfo` and checking the ini file used. – ToBe Jan 21 '15 at 15:56
  • I think if there is a way to just tell the small browser buttons in PHPStorm to load normal apache localhost instead of http://localhost:63342/ with which it is currently trying and failing, the problem will be resolved. But I do not know if that's possible to do. – Nikhil Khullar Jan 21 '15 at 16:04
  • 1
    @NikhilKhullar *"to load normal apache localhost instead of localhost:63342"* **1)** PHP used by built-in simple web server is your PHP Interpreter that you have selected as Default for this project -- check `Preferences | Languages and Frameworks | PHP` for that. **2)** You can make your Apache as default at any time -- just create new Deployment entry ("In Place" type could be fine), configure it accordingly (correct URL etc) and mark it as Default for this project. Now IDE will use those URLs instead of built-in server. – LazyOne Jan 21 '15 at 18:46

0 Answers0