Tuesday, 2 March 2021

Install php on Mac

Step 1: Open terminal and execute below command.

brew install php

 

Once installation is successful, execute the command ‘php -v’ to confirm the installation.

$ php -v
PHP 8.0.2 (cli) (built: Feb  4 2021 17:58:53) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.2, Copyright (c), by Zend Technologies

 

Step 2: Configure php.ini file.

 

Open php.ini file and enable necessary apache module.

/usr/local/etc/php/{PHP_VERSION}/php.ini

 

 

Once installation is successful, you have two options to launch php.

 

a.   To have launchd start php now and restart at login:

                   brew services start php

b.   if you don't want/need a background service you can just run:

                  php-fpm

 

 

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment