Opening up the terminal on a Mac always starts a PHP process

1

I am on a Mac running Yosemite 10.10.4 and every time I start terminal or open a new terminal tab I am inside of an actively running php process. I must Ctrl+C before I can do anything else. I don’t see any Mac terminal options that is automatically starting this process.

I have Homebrew installed and I’m using a LEMP stack, so I’m not sure if there is some misconfiguration there? I’ve searched everywhere, tried running brew doctor and brew update, but everything is ready to brew and up to date.

Here is my terminal output when starting a new session:

 Last login: Thu Aug 20 13:31:52 on ttys000
 ^C
 MacBook-Pro:~ adam2k$

And my php version:

 MacBook-Pro:~ adam2k$ php -v
 PHP 5.6.6 (cli) (built: Mar  5 2015 19:48:00) (DEBUG)
 Copyright (c) 1997-2015 The PHP Group
 Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
 MacBook-Pro:~ adam2k$ 

adam2k

Posted 2015-08-20T17:48:35.577

Reputation: 13

Question was closed 2015-09-14T14:28:21.593

What does the general page of Terminal preferences show? – user151019 – 2015-08-20T18:08:33.010

@Mark - it shows - On Startup Open: New Window with Profile: Pro - Shells Open with: Default login shell - New Windows Open with: Default Profile, Default Working Directory - New Tabs Open with: Same Profile, Same Working Directory – adam2k – 2015-08-20T19:10:32.123

In System Preferences, select users and right click on its name. "Advanced options..." will appear. and that will show default shell - what is there? (You might need to enable editing) – user151019 – 2015-08-20T19:28:03.500

pr equivalently from the command line dscl . -read /Users/username UserShell making the obvious change – user151019 – 2015-08-20T19:30:21.883

OK then what do the startup scripts ~/.bash_login ~/.profile etc show One of them probably start php – user151019 – 2015-08-21T13:00:04.130

@Mark - thanks! I'm seeing this in my .bash_profile: /usr/local/Cellar/php56/5.6.6/bin/php if I remove that will php not start when I restart my computer? Is there a way to have php start and also not automatically open in terminal? – adam2k – 2015-08-21T20:18:37.680

That is more complex you want it as an apache plugin - for dev look at camp – user151019 – 2015-08-21T21:19:11.120

Answers

1

The default shell that Terminal starts is found by running the command:

dscl . -read /Users/username UserShell

Making the obvious change.

The current Mac OS X default shell is /bin/bash. This runs various startup files including ~/.bash_profile. Search these for PHP code and remove that line.

PHP can be started manually in a terminal but its main use is in a web server as an Apache (or other web server) plugin.

user151019

Posted 2015-08-20T17:48:35.577

Reputation: 5 312

Correct answer, but PHP in the command line is 100% different than the web server module. You could technically remove the PHP command line interpreter and the Apache (or other web server) module would work just fine. – JakeGould – 2015-09-07T04:08:25.417