Return to site

Apache Server For Mac

broken image


The new macOS Catalina comes with Apache pre-installed. All we have to do is switch it on. Open Terminal using macOS Spotlight or go to /Applications/Utilities and open Terminal. To check the version of Apache installed run the following command in the Terminal. $ httpd -v Server version: Apache/2.4.41 (Unix) Server built: Aug 29 2019. Apache HTTP Server 2.4.46 (httpd): 2.4.46 is the latest available version 2020-08-07. Result when server is stoped sudo apachectl -k stop will be: Apache server is not running Result when server is running sudo apachectl -k stop will be: tcp46 0 0.https. LISTEN tcp46 0 0.http. LISTEN In this example I have two servers running, one with https and another with http. 2) Install apache 2.0 The homebrew package installer can be used to install Apache 2.0 on MacOS. The installer installs the Apache HTTP server on the location /usr/local/Cellar/httpd. 3) Start apache Apache provides a service named as apachectl which needs to be started in order to start Apache. The command needs super user privileges to be executed hence we have to use sudo to get the.

I mainly do web development on my 15 in Macbook Pro. Mac runs on base Unix foundation so mainly you could install almost all Linux/Unix software on Mac very easily.

Mac OS X comes by default with ApacheWeb Server and PHP. In this tutorial we will go over steps on how to enable those on Mac.

Restart

Let's get started:

Enable Apache Web Server

Step-1

Open terminal App and run below command:

Step-2

Open browser and check with URL: http://localhost Cummins 903 service manual.

Enable PHP Module and verify Perl module

Step-1

Open Terminal App. Mac OS X comes by default with Perl library. Just type below commands to check Perl and PHP Setup.

Terminal Commands
2
4
6
8
10
12
14
16
18
/usr/bin/perl
bash-3.2# pwd
total120
-rw-r--r--1root wheel13077Sep92014magic
drwxr-xr-x14root wheel476Sep92014extra
-rw-r--r--1root wheel20786Sep92014httpd.conf
-rw-r--r--1root wheel20786Jun913:55httpd.conf.bak
bash-3.2# vi httpd.conf

Step-2

Open file httpd.conf file. You may use any Text Editor also.

Uncomment the following line (remove #): LoadModule php5_module libexec/apache2/libphp5.so

Step-3

Restart Apache Web Server:

Step-4

  • Find DocumentRoot from httpd.conf file. In my case it's /Users/crunchify/Documents/Blogs/MAMP as I'm using MAMP on my Mac.
  • You may have diff folder something like /Library/WebServer/Documents/.
  • Create below file crunchify-php-on-mac.php under your DocumentRoot folder.
  • If you don't see folder Web Server then just create it 🙂
Apache server for mac download
crunchify-php-on-mac.php
2
4
6
8
<head>
</head>
echo'

Hello World - PHP Testcase on Mac OS X by Crunchify.com..


Have a fun. Enjoy.'
;?>
</html>

Step-5

Now visit this URL: http://localhost/crunchify-php-on-mac.php and you should see php file loaded successfully on browser.

How to Kill Apache httpd process on Mac?

Just incase if you need to kill apache httpd process on Mac then you could use below commands.

Apache Server For Mac

Let's get started:

Enable Apache Web Server

Step-1

Open terminal App and run below command:

Step-2

Open browser and check with URL: http://localhost Cummins 903 service manual.

Enable PHP Module and verify Perl module

Step-1

Open Terminal App. Mac OS X comes by default with Perl library. Just type below commands to check Perl and PHP Setup.

Terminal Commands
2
4
6
8
10
12
14
16
18
/usr/bin/perl
bash-3.2# pwd
total120
-rw-r--r--1root wheel13077Sep92014magic
drwxr-xr-x14root wheel476Sep92014extra
-rw-r--r--1root wheel20786Sep92014httpd.conf
-rw-r--r--1root wheel20786Jun913:55httpd.conf.bak
bash-3.2# vi httpd.conf

Step-2

Open file httpd.conf file. You may use any Text Editor also.

Uncomment the following line (remove #): LoadModule php5_module libexec/apache2/libphp5.so

Step-3

Restart Apache Web Server:

Step-4

  • Find DocumentRoot from httpd.conf file. In my case it's /Users/crunchify/Documents/Blogs/MAMP as I'm using MAMP on my Mac.
  • You may have diff folder something like /Library/WebServer/Documents/.
  • Create below file crunchify-php-on-mac.php under your DocumentRoot folder.
  • If you don't see folder Web Server then just create it 🙂
crunchify-php-on-mac.php
2
4
6
8
<head>
</head>
echo'

Hello World - PHP Testcase on Mac OS X by Crunchify.com..


Have a fun. Enjoy.'
;?>
</html>

Step-5

Now visit this URL: http://localhost/crunchify-php-on-mac.php and you should see php file loaded successfully on browser.

How to Kill Apache httpd process on Mac?

Just incase if you need to kill apache httpd process on Mac then you could use below commands.

2
sudo launchctl unload/System/Library/LaunchDaemons/org.apache.httpd.plist

Enjoy and Happy coding…

Join the Discussion

Apache Server For Macos

If you liked this article, then please share it on social media or leave us your comments. Limited time 3 months free WPEngine hosting.

Install Apache On Mac Os

Other Popular Articles..





broken image