2

I am trying to install php-cgi on my macbook (Yosemite 10.9.3) because the PhpStorm IDE keeps coming back to me "php-cgi not found" when i try to open things in browser. I tried to use a newer version of php interpreter because the current version is 5.4. But I can only find the packages in the php.net site but I have no clue how to install it. I also tried to download homebrew but again have no clue how to start there. I tried to use MacPort to install a fastcgi by using this line: sudo port install php5 +fastcgi

But it returns this:

--->  Dependencies to be installed: autoconf213 gawk gettext expat libiconv ncurses readline m4 perl5 perl5.16 gdbm bzip2 gsed libtool libxml2 xz zlib mhash pcre libedit pkgconfig

--->  Fetching archive for expat
--->  Attempting to fetch expat-2.1.0_0.darwin_13.x86_64.tbz2 from http://packages.macports.org/expat
--->  Attempting to fetch expat-2.1.0_0.darwin_13.x86_64.tbz2.rmd160 from http://packages.macports.org/expat
--->  Installing expat @2.1.0_0
--->  Activating expat @2.1.0_0
Error: org.macports.activate for port expat returned: Image error: /opt/local/bin/xmlwf already exists and does not belong to a registered port.  Unable to activate port expat. Use 'port -f activate expat' to force the activation.
Error: Failed to install expat
Please see the log file for port expat for details: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_textproc_expat/expat/main.log
Error: The following dependencies were not installed: autoconf213 gawk gettext expat libiconv ncurses readline m4 perl5 perl5.16 gdbm bzip2 gsed libtool libxml2 xz zlib mhash pcre libedit pkgconfig
To report a bug, follow the instructions in the guide:http://guide.macports.org/#project.tickets
Error: Processing of port php5 failed

I run a self-update with the MacPort already (version 2.3.0). Can anyone help out? Thank you so much!

P.S. For PhpStorm, I am forced to use the built-in web server when i try to view the code in the browser. If anyone got a way to do that without their built-in server, that would be great too. I have a zend server installed already.

P.S. I am using NetBeans now. But I guess it is good to make sure I get things like this settled while I am working on other things.

Angelo
  • 185
  • 1
  • 2
  • 15

2 Answers2

5

It took me a few tries to get PhpStorm setup with MacPorts. These are the basic steps:

sudo port install php53 php53-cgi

This should create /opt/local/bin/php53 and php-cgi53, so next:

cd /opt/local/bin
ln -s php53 php
ln -s php-cgi53 php-cgi

Then register the PHP Interpreter with PHP Home set to /opt/local/bin and it should detect it and "Open in Browser" correctly.

Nic Cottrell
  • 9,401
  • 7
  • 53
  • 76
  • creating the php-cgi symlink actually worked. I think PHPStorm just searched for php-cgi in the $PATH configuration. Big thanks – dehart Dec 03 '19 at 10:53
1

For PhpStorm, I am forced to use the built-in web server when i try to view the code in the browser. If anyone got a way to do that without their built-in server, that would be great too. I have a zend server installed already.

You are NOT forced in any way.

Just configure Deployment entry (Preferences | Deployment) and mark it as Default for this project. The URL defined there will be used when previewing pages from PhpStorm.

Without deployment entry the built-in web server is used by default.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
  • I configured that already but it is still using the built-in server. is there way that I can completely get rid of it? – Angelo Jun 26 '14 at 18:43
  • Just to be clear, mine is a MacBook and its setting is slightly different from that in Windows – Angelo Jun 26 '14 at 18:45
  • 1) *"I configured that already but it is still using the built-in server"* Proofs please (screenshot of your settings etc). Right now it sounds like you have not configured it properly. 2) I have not mentioned Windows anywhere .. so I do not know what this comment is about -- please clarify. – LazyOne Jun 26 '14 at 18:59
  • I eventually got it figured out. The problem is in the default button. They really should try to make it clearer. – Angelo Jun 27 '14 at 16:24
  • *"The problem is in the default button."* And that problem is ...? Please illustrate with screenshot or something. – LazyOne Jun 27 '14 at 16:34
  • not necessarily a problem but I guess it is just hard to tell if the default button is on or not. Also, for first time user, especially for learner, the fact that mapping tab is blank when it is not set as default is not helping. Also of course the fact that there is also a "default deployment" tab under file is confusing as well. – Angelo Jul 01 '14 at 17:25