How do I install/allow php to run on Yosemite? I've read a lot about doing stuff through terminal, but none of the 'tutorials' are thorough, they just tell me to do 'sudo....' I've tried it, and still, I cannot get php files to work (I'm making a website and I need a php file).
If you are not very familiar with the command line and config files (and it appears that you are not) then get Apple's Server app (US$20 at the app store). PHP then becomes a check-the-box setup option, as does local DNS (also essential).
The only common web-related app you will actually need to install via the command line is mysql. There is a package installer on Oracle's website.
Or you could just use MAMP which is an installable and easily removable installation of Apache, MySQL and PHP entirely separate from that which is installed with and in the operating system.
I like it because it is simple and if I mess something up in my tinkering I just trash the MAMP folder and reinstall.
It is free (though they do offer a commercial, supported, edition) and works just as well as the components that come with Mac O/S.
I have no interest in the company, I've just used it quite a bit in the past. Developing websites and even hosting them.
To run PHP files, you need PHP interpreter (basically
You can install PHP using Homebrew using the following Terminal command:
brew install php56
If you don't have Homebrew yet, install via:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then use Apache, php-fpm or php built-in server (e.g.
php -S localhost:8888) to run the site.
Or to run standalone files, run them directly, e.g.