How to install and configure Apache, MySQL and PHP on Mac OS X 10.7 Lion and OS X 10.6 Snow Leopard. OSX 10.8 Mountain Lion Version OSX 10.9 Mavericks Version Apache and PHP already come preloaded in OS X 10.7 Lion and 10.6 Snow Leopard, the versions on 10.7 Lion are PHP 5.3.6 and Apache 2.2.20, these 2 pieces of Open Source software are part of the âAMPâ stack with MySQL the missing third.
A few weeks ago, The Rocket Yard ran an article detailing the many services that will be removed from macOS Server in the near future. Today, Iâll discuss how to bring back one of those services â web hosting â using both the Apache web server that is built into macOS and the full MAMP suite.
Apache Web Server
Most Mac users donât realize it, but macOS comes with its own built-in web server. Apache is an open-source web server that has been available since 1995, and as of 2016, it was the engine behind 46% of all websites and 43% of the top million websites in terms of traffic.
Having a web server built into macOS is perfect for those who want to share information in a small workgroup or set up and test sites on a development web server before deploying them to an internet server. These instructions show you how to set up Apache server in macOS High Sierra. Youâll need to have some knowledge of the Terminal app and how to run command line programs, an understanding of web servers, and a familiarity with the vi editor.
To begin, we edit the Apache configuration file as root:
sudo vi /etc/apache2/httpd.conf
A web server is relatively useless without a server-side scripting language with which to handle interactions; the most popular languages are PHP, Perl, and Python. In this example, weâll enable PHP and Perl. To do so, youâll need to uncomment line 176 of the configuration file. In the vi editor, you can do this easily by typing 176G to go directly to line 176. Next, type an x over the # at the beginning of the following line to delete the # comment marker:
#LoadModule php7_module libexec/apache2/libphp7.so
We want to do the same to be able to run Perl scripts, which is in line 177 of the configuration file. Use your arrow key to go down to the beginning of the next line, then type the x over the # to delete the comment marker. The configuration file should then looks something like this around line 176 (see screenshot below):
Editing the Apache configuration file in the vi editor
To save your changes in the editor, type :w!
We still need to enable personal websites by uncommenting line 173, so type 173G and press return, then type an x over the # to delete it. The same must be done with line 513 of the file â type 513G and press return, then type an x over the # to delete it. Now weâll save these two final changes and quit the editor by typing ZZ.
The last command just enabled a file named http-userdir.conf, and we now need to edit it: In Terminal, enter: How to build a patch omnisphere 2.
sudo vi /etc/apache2/extra/httpd-userdir.conf
In this configuration file, we need to uncomment line 16. Type 16G and press return, then type an x over the # to delete it. Save and exit by typing 16G.
Can you use apps on your mac. Up until Mac OS X Lion, it was possible to share websites with a local workgroup and create personal websites with a click; to publish web pages, you simply put your html files into a Sites folder. Now we have to do a lot more work. Letâs manually create a Sites folder in Terminal and make a small test file so we know our web server is working.
Enter the following commands:
mkdir ~/Sites
echo â<html><body><h1>Welcome to my site</h1></body></html>â > ~/Sites/index.html.en
Next, we need to make sure that we have a user configuration file. To create one, type in
sudo vi /etc/apache2/users/<your short user name>.conf
Where <your short user name> is your Unix short user name. Donât know what that name is? Look at the top of the Terminal window and youâll see a name listed â thatâs the short user name. In my case, itâs stevensande, so Iâd enter
sudo vi/etc/apache2/users/stevensande.conf (donât use this for YOUR configuration file!)
In that configuration file we want to enter the following (cutting and pasting into vi works):
<Directory â/Users/<your short user name>/Sites/â>
AddLanguage en .en AddHandler perl-script .pl PerlHandler ModPerl::Registry Options Indexes MultiViews FollowSymLinks ExecCGI AllowOverride None Require host localhost </Directory>
Once again, remember to replace <your short user name> with your short user name. Type ZZ to save the new configuration file and quit the editor.
If youâve made it this far⦠congratulations! Now letâs check our configuration of Apache by running the following command in Terminal:
apachectl configtest
Youâll probably get a warning message that says âhttp: Could not reliably determine the serverâs full qualified domain nameâ along with how to resolve that issue; since this is just for a local web server, ignore that warning â what you do want to see is the last line: Syntax OK.
If everything is fine up to this point, youâre ready to start up Apache. If any of the configuration file syntax is incorrect, youâll receive warnings on what needs to be fixed.
At long last, weâre ready to launch the Apache httpd service:
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
To see our one line web page, launch Safari or your favorite browser and enter http://localhost/
You should see:
It works!
To see your user home directory, enter http://localhost/~<your short user name>, once again replacing <your short user name> with your Unix short user name. It should say:
Welcome to my site
Should you decide to shut down the Apache service, thereâs a simple one-line Terminal command to do so:
sudo /usr/sbin/apachectl stop
Making life easier with MAMP
That was a lot of work to get things up and running, wasnât it? Thereâs a much easier way to set up a local test server! For quite a while, developers have realized that packaging Apache, MySQL (a database server), and PHP/Python/Perl was the best way to get a very powerful web server. Add âMacâ to the beginning of this, and you have MAMP â Mac, Apache, MySQL, and PHP/Python/Perl. The âAMPâ distributions (LAMP for Linux, WAMP for Windows, MAMP for Mac) are the backbone of the wildly popular WordPress platform, so if you want a very complete WordPress development environment on your Mac, youâve come to the right place.
MAMP comes in two varieties; the free MAMP solution for a personal web server and MAMP Pro ($59), which adds additional services like email, dynamic DNS, and more. For this post, weâll install and configure the free MAMP.
1)Download MAMP from the MAMP website
2) Open the .pkg file and follow the installation instructions to install MAMP to your Mac
3) Once the installation is complete, youâll find two folders in your Applications folder â one for MAMP, and another that is a 14-day free trial for MAMP Pro. Open the folder named MAMP and launch the MAMP app. Youâll see something that looks like this screenshot:
The MAMP startup interface
4) Click the âStart Serversâ button.
MAMP will start both the Apache and MySQL servers, then launches a webpage that confirms that your MAMP installation is complete (see screenshot below):
(The MAMP welcome page, indicating that all services are running.)
The âMy Websiteâ link shows an empty page, but you can change that by placing an index.html file into the htdocs folder found in the MAMP folder. Itâs easy to change the Document Root directory by going to MAMP > Preferences > Web Server.
Note that MAMP Pro also brings âExtrasâ to the table; these are packages designed by the MAMP team to install quickly and bring added functionality. Remember my comments about WordPress? There is not only a MAMP Extra for WordPress, but for Joomla, Drupal and other content management systems as well.
Be Sociable, Share This!
Prices, terms, and availability subject to change without notice. Not responsible for typographical, technical, or descriptive errors of products herein.
OWC is on-site wind turbine powered at 8 Galaxy Way, Woodstock, IL 60098 | 1-800-275-4576 | +1-815-338-8685 (International) All Rights Reserved, Copyright 2018, OWC â Since 1988
Contents
To install Apache Kafka on Mac, Java is the only prerequisite. https://potnew776.weebly.com/mac-theme-for-windows-7-64-bit-download.html. First we shall look into the installation steps of Java and then we shall setup Apache Kafka and run it on the Mac.
Install Java
You may verify the installation of Java on Mac, by running the following command on a Terminal.
Install Apache Kafka on MacApache Tomcat For Mac
Start Zookeeper
Apache Kafka depends on Zookeeper for cluster management. Hence, prior to starting Kafka, Zookeeper has to be started. There is no need to explicitly install Zookeeper, as it comes included with Apache Kafka.
From the root of Apache Kafka, run the following command to start Zookeeper :
The zookeeper should be started with a similar following trace in the output.
Start Apache Kafka ServerApache Maven For Mac
Open another Terminal and run the following command from the root of Apache Kafka to start Apache Kafka.
Following should be the end of trace stating that Kafka server is started.
Apache For Macos
Apache Server For MacConclusion :
In this Apache Kafka Tutorial, we have successfully learnt to install Apache Kafka on Mac and start Kafka along with Zookeeper.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |