PHP stands for HyperText Preprocessor is a server-side programming language. Originally it was developed for web development but now is also used as a general-purpose language. It was created by Rasmus Lerdorf in 1994. This tutorial will help you to install PHP on macOS. PrerequisitesBefore starting the installation of Node.js and NPM using this tutorial you must have the following prerequisites. Terminal: You must have Mac Terminal access and little knowledge about working with the terminal application.
Ao login to your Mac system and open terminal. Homebrew: Homebrew is a popular package manager for the Mac operating systems. It is useful for installing most open source software like Node. Download and Install PHP on macOSThe latest version of macOS Sierra ships with PHP 5.6 and similarly OSX 10.11 El Capitan with PHP 5.5, OSX 10.8 Mountain Lion ships with PHP version 5.3.
The latest version of PHP 7.2 is available to install. The below steps to help you to install PHP 7.2 or 7.1 or 5.6 on macOS.Open a terminal and run below commandsInstall PHP 7.3 curl -s bash -s 7.3Install PHP 7.2 curl -s bash -s 7.2Install PHP 7.1 curl -s bash -s 7.1Install PHP 5.6 – Running with OSX 10.11 El Capitan or lower versions. Curl -s bash -s 5.6Verify PHP InstallationThe PHP versions for macOS are maintained by and doesn’t overwrite the current php binaries installed on your system. The installs everything in /usr/local/php5. The new php binary is therefore in /usr/local/php5/bin/php. Export PATH=/usr/local/php5/bin:$PATHTo verify the correct version of PHP is installed on your system, Execute the following command. Php -vPHP 7.2.2 (cli) (built: Feb 1 2018 13:23:34) ( NTS )Copyright (c) 1997-2018 The PHP GroupZend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologieswith Zend OPcache v7.2.2, Copyright (c) 1999-2018, by Zend Technologieswith Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick RethansAlso, create a phpinfo.php under your web root directory with the following contents and access the file in web browser.
Sep 26, 2019 PHP 7.3.10 - Server-side, cross-platform, HTML embedded scripting language. Download the latest versions of the best Mac apps at safe and trusted MacUpdate. Download FileZilla Client 3.45.1 for Mac OS X. The latest stable version of FileZilla Client is 3.45.1. Please select the file appropriate for your platform below.
Posted on in + + + + 15 minutes Part 1: macOS 10.15 Catalina Web Development EnvironmentDeveloping web applications on macOS is a real joy. There are plenty of options for setting up your development environments, including the ever-popular that provides a nice UI on top of Apache, PHP and MySQL. However, there are times when MAMP Pro has slow downs, or out of date versions, or is simply behaving badly due to its restrictive system of configuration templates and non-standard builds.It is times like these that people often look for an alternative approach, and luckily there is one, and it is relatively straight-forward to setup.In this blog post, we will walk you through setting up and configuring Apache 2.4 and multiple PHP versions.
In the second blog post in this two-post series, we will cover MySQL, Apache virtual hosts, APC caching, and Xdebug installation. This guide is intended for experienced web developers. If you are a beginner developer, you will be better served using. XCode Command Line ToolsIf you don't already have XCode installed, it's best to first install the command line tools as these will be used by homebrew: $ xcode-select -install Homebrew InstallationThis process relies heavily on the macOS package manager called Homebrew. Using the brew command you can easily add powerful functionality to your mac, but first we have to install it. This is a simple process, but you need to launch your Terminal ( /Applications/Utilities/Terminal) application and then enter: $ /usr/bin/ruby -e '$(curl -fsSL follow the terminal prompts and enter your password where required.
This may take a few minutes, but when complete, a quick way to ensure you have installed brew correctly, simply type: $ brew -versionHomebrew 2.1.13Homebrew/homebrew-core (git revision 99f8; last commit 2019-10-08)You should probably also run the following command to ensure everything is configured correctly: $ brew doctorIt will instruct you if you need to correct anything. Catalina Required LibrariesWhen installing fresh on Catalina, I ran into a few libraries that were missing when completing all the steps below. To make things easier, please simply run these now: $ brew install openldap libiconv Apache InstallationThe latest macOS 10.15 Catalina comes with Apache 2.4 pre-installed, however, it is no longer a simple task to use this version with Homebrew because Apple has removed some required scripts in this release. However, the solution is to install Apache 2.4 via Homebrew and then configure it to run on the standard ports (80/443).If you already have the built-in Apache running, it will need to be shutdown first, and any auto-loading scripts removed. It really doesn't hurt to just run all these commands in order - even if it's a fresh installation: $ sudo apachectl stop$ sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2/dev/nullNow we need to install the new version provided by Brew: $ brew install httpdWithout options, httpd won't need to be built from source, so it installs pretty quickly.
Upon completion you should see a message like: ? /usr/local/Cellar/httpd/2.4.411: 1,652 files, 27.7MBNow we just need to configure things so that our new Apache server is auto-started $ sudo brew services start httpdYou now have installed Homebrew's Apache, and configured it to auto-start with a privileged account. It should already be running, so you can try to reach your server in a browser by pointing it at you should see a simple header that says 'It works!' .Troubleshooting TipsIf you get a message that the browser can't connect to the server, first check to ensure the server is up.
$ ps -aef grep httpdYou should see a few httpd processes if Apache is up and running.Try to restart Apache with: $ sudo apachectl -k restartYou can watch the Apache error log in a new Terminal tab/window during a restart to see if anything is invalid or causing a problem: $ tail -f /usr/local/var/log/httpd/errorlogApache is controlled via the apachectl command so some useful commands to use are: $ sudo apachectl start$ sudo apachectl stop$ sudo apachectl -k restart. The -k will force a restart immediately rather than asking politely to restart when apache is good and ready Visual Studio CodeIn past guides, I've always provided instructions to edit files using the default TextEdit application that comes pre-installed. However, this is not what I use myself as it's a terrible editor and when testing my guide for Catalina, I kept running into problems with encoding, finding line numbers etc. The better solution is to simply install a better editor. So please install the amazingly versatile yet, 100% free, Visual Studio Code.
It's available on Mac, Windows, and Linux, but right now we only care about the mac version.Go to the and click Download for MacOnce downloaded, drag the application to your preffered Applications location. Next, you want to install the command line tools, so follow the so that you can use the code command from the Terminal. Apache ConfigurationNow that we have a working web server, we will want to do is make some configuration changes so it works better as a local development server.In the latest version of Brew, you have to manually set the listen port from the default of 8080 to 80, so we will need to edit Apache's configuration file.
/usr/local/etc/httpd/httpd.confIf you followed the instructions above you should be able to use Visual Studio Code to edit your files using the code Terminal command. However, if you want to use the default TextEditor application to perform edits, you can use the open -e command followed by the path to the file. $ code /usr/local/etc/httpd/httpd.confFind the line that says Listen 8080and change it to 80: Listen 80Next we'll configure it to use the to change the document root for Apache. This is the folder where Apache looks to serve file from. By default, the document root is configured as /usr/local/var/www. As this is a development machine, let's assume we want to change the document root to point to a folder in our own home directory.Search for the term DocumentRoot, and you should see the following line: DocumentRoot '/usr/local/var/www'Change this to point to your user directory where youruser is the name of your user account: DocumentRoot /Users/youruser/SitesYou also need to change the tag reference right below the DocumentRoot line. This should also be changed to point to your new document root also.
We removed the optional quotes around the directory paths as TextEdit will probably try to convert those to smart-quotes and that will result in a Syntax error when you try to restart Apache. Even if you edit around the quotes and leave them where they are, saving the document may result in their conversion and cause an error.In that same block you will find an AllowOverride setting, this should be changed as follows: # AllowOverride controls what directives may be placed in.htaccess files.# It can be 'All', 'None', or any combination of the keywords:# AllowOverride FileInfo AuthConfig Limit#AllowOverride AllAlso we should now enable modrewrite which is commented out by default.
Search for modrewrite.so and uncomment the line by removing the leading #: LoadModule rewritemodule lib/httpd/modules/modrewrite.so User & GroupNow we have the Apache configuration pointing to a Sites folder in our home directory. One problem still exists, however. By default, apache runs as the user daemon and group daemon. This will cause permission problems when trying to access files in our home directory.
About a third of the way down the httpd.conf file there are two settings to set the User and Group Apache will run under. Change these to match your user account (replace youruser with your real username), with a group of staff: User youruserGroup staff ServernameApache likes to have a server name in the configuration, but this is disabled by default, so search for: #ServerName www.example.com:8080and replace it with: ServerName localhost Sites FolderNow, you need to create a Sites folder in the root of your home directory. You can do this in your terminal, or in Finder. In this new Sites folder create a simple index.html and put some dummy content in it like: My User Web Root. $ mkdir /Sites$ echo 'My User Web Root' /Sites/index.htmlRestart apache to ensure your configuration changes have taken effect: $ sudo apachectl -k restart. If you have existing PHP installations via Brew, you need to first cleanup your setup with our guide before continuing with this section.Up until the end of March 2018, all PHP related brews were handled by Homebrew/php tab, but that has been deprecated, so now we use what's available in the Homebrew/core package. This should be a better maintained, but is a much less complete, set of packages.Both PHP 5.6 and PHP 7.0 has been deprecated and removed from Brew, and while it's not recommended for production, there are legitimate reasons to test these unsupported versions in a development environment.Remember only PHP 7.1 through 7.3 are officially supported by Brew so if you want to install PHP 5.6 or PHP 7.0 you will need to add this tap: $ brew tap exolnet/homebrew-deprecatedWe will proceed by installing various verions of PHP and using a simple script to switch between them as we need.
Feel free to exclude any versions you don't want to install. $ brew install [email protected]$ brew install [email protected]$ brew install [email protected]$ brew install [email protected]$ brew install [email protected] first one will take a little bit of time as it has to install a bunch of brew dependencies. Subsequent PHP versions will install faster.
You no longer have to unlink each version between installing PHP versions as they are not linked by defaultAlso, you may have the need to tweak configuration settings of PHP to your needs. A common thing to change is the memory setting, or the date.timezone configuration. The php.ini files for each version of PHP are located in the following directories: /usr/local/etc/php/5.6/php.ini/usr/local/etc/php/7.0/php.ini/usr/local/etc/php/7.1/php.ini/usr/local/etc/php/7.2/php.ini/usr/local/etc/php/7.3/php.iniLet's switch back to the first PHP version now: $ brew unlink [email protected] && brew link -force -overwrite [email protected]. At this point, I strongly recommend closing ALL your terminal tabs and windows. This will mean opening a new terminal to continue with the next step.
This is strongly recommended because some really strange path issues can arise with existing terminals (trust me, I have seen it!).Quick test that we're in the correct version: php -vPHP 5.6.40 (cli) (built: Apr 23 2019 11:14:34)Copyright (c) 1997-2016 The PHP GroupZend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologieswith Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies Apache PHP Setup - Part 1You have successfully installed your PHP versions, but we need to tell Apache to use them. You will need to switch to each of your installed PHP versions and run update again to get updates for each PHP version and ensure you are running the version of PHP you intend.
Activating Specific/Latest PHP VersionsDue to the way our PHP linking is set up, only one version of PHP is linked at a time, only the current active version of PHP will be updated to the latest version. I had originally planned on penning a blog post about how easy it is to setup and deploy a Grav site with with. While that is a fantastic VPS service, someone on Gitter asked me about setting up Grav on Amazon's AWS, so I checked it out. What I found was pretty amazing.
![Download Download](http://images.sftcdn.net/images/t_optimized,f_auto/p/babb3b42-9aa2-11e6-8931-00163ec9f5fa/666750649/taco-html-edit-screenshot.jpg)
![Php Php](/uploads/1/2/5/6/125621502/863380683.jpg)
Even the free tier of the EC2 t2.micro package runs Grav like a boss! Combine this with awesome automated setup and server management via ServerPilot, and you have the makings of an unbeatable combination. In this blog post I'll go through step-by-step on how to get this setup on your own. The hardest part is setting up EC2 as it's a bit ungainly, but other than that it's a doddle, and more importantly, it's free! So, you’ve decided to get Grav and build a site with it.
Building with Grav gives you the power and flexibility you need to realize your site but you need to develop that site first. Using an efficient development strategy will allow you to build your site faster and hassle-free.
You might even have fun while doing it!When you look at how easy it is to set Grav up and get it running on a remote server, it can be very tempting to just do development there, especially given the fact that there are no databases to migrate over, and everything is file-based. However, don't be tempted by this approach! In this blog post I'll endeavor to explain why.