{"id":19441,"date":"2014-02-28T23:01:19","date_gmt":"2014-02-28T15:01:19","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=19441"},"modified":"2025-04-04T01:42:26","modified_gmt":"2025-04-03T17:42:26","slug":"osx-apache-mysql-php-part-3","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/","title":{"rendered":"Easy Mac Setup: Install PHP, Apache &#038; MySQL &#8211; Part III"},"content":{"rendered":"<p>This is the last part of our series: <strong>Install PHP, Apache, and MySQL in Mac without MAMP<\/strong>. And if you have been following the series (see <a href=\"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-1\/\">Part 1<\/a> and <a href=\"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-2\/\">Part 2<\/a> here) and have created projects in <code>~\/Sites<\/code>, then access <code>localhost:8888<\/code> in the Browser, you will find that they are displayed as shown in the following screenshot.<\/p>\n<p>I\u2019m a bit picky when it comes to user interface of Applications, and the way how Apache server presents the folders intrigues me to customize it, make it look nicer. And this is what we are going to do in this tutorial.<\/p>\n<p>If you are ready, let\u2019s just get started.<\/p>\n<h2>Getting Started<\/h2>\n<p>First let\u2019s create a new PHP file named <strong>index.php<\/strong> right under the ~\/Sites folder. Then, create a folder named <strong>assets<\/strong> to store files like the images and CSS that we will be using along with the PHP file, <strong>index.php<\/strong>.<\/p>\n<p>Open the <strong>index.php<\/strong> in code editor, and add a <a href=\"https:\/\/creatiface.com\/articles\/basic-html5-structure\" rel=\"nofollow\">basic HTML5 structure<\/a> as well as a few additional <a href=\"https:\/\/www.hongkiat.com\/blog\/tag\/html\/\">HTML5 tags<\/a>, like so.<\/p>\n<pre>\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;Sites&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;div class=\"wrapper\"&gt;\r\n\t&lt;header class=\"site-header\"&gt;\r\n\t\t&lt;h1&gt;Sites&lt;\/h1&gt;\r\n\t&lt;\/header&gt;\r\n\t&lt;div class=\"site-body\"&gt;\r\n\t\t\r\n\t&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>We will put our codes under the <code>div<\/code> with the <code>.site-body<\/code> class.<\/p>\n<h2>Write PHP Functions<\/h2>\n<p>First, we need to retrieve several required pieces of information from the server, which are the HTTP Host, Current Directory where we put <strong>index.php<\/strong> folder, and the list of items that are stored in the current directory.<\/p>\n<p>Here are all the codes, make sure that you wrap these with <code>&lt;?php ?&gt;<\/code>.<\/p>\n<pre>\r\n$server  = \"http:\/\" . $_SERVER['HTTP_HOST'];\r\n$cur_dir = getcwd();\r\n$folders = scandir($cur_dir);\r\n<\/pre>\n<p>You can view the values in those PHP variables with <code>var_dump<\/code> or <code>print_f<\/code>. For example:<\/p>\n<pre>\r\nvar_dump($folders);\r\n<\/pre>\n<p>This will output the list of folders and files in that we have retrieved with PHP <code>scandir()<\/code> function in a form of array. In my case, it looks like this:<\/p>\n<pre>\r\narray(12) { \r\n\t[0]=> string(1) \".\" \r\n\t[1]=> string(2) \"..\" \r\n\t[2]=> string(9) \".DS_Store\" \r\n\t[3]=> string(6) \"assets\" \r\n\t[4]=> string(4) \"demo\" \r\n\t[5]=> string(3) \"dev\" \r\n\t[6]=> string(10) \"frameworks\" \r\n\t[7]=> string(4) \"hkdc\" \r\n\t[8]=> string(4) \"html\" \r\n\t[9]=> string(9) \"index.php\" \r\n\t[10]=> string(11) \"phpinfo.php\" \r\n\t[11]=> string(12) \"repositories\" \r\n}\r\n<\/pre>\n<p>Then, we put these items in HTML list structure using PHP loop, <code><a href=\"http:\/\/www.php.net\/manual\/en\/control-structures.foreach.php\" rel=\"nofollow\">foreach<\/a><\/code>.<\/p>\n<pre>\r\necho '&lt;ol&gt;';\r\nforeach ($folders as $folder) {\r\n\tif ($folder === '.' or $folder === '..' or $folder === 'assets') continue;\r\n\tif (is_dir($cur_dir . '\/' . $folder)) {\r\n\t\techo '&lt;li class=\"site-folder\"&gt;'; \/\/ open list\r\n\t\techo '&lt;a class=\"folder-icon\" href=' . $server . '\/' . $folder . '&gt; ' . $folder . ' &lt;\/a&gt;'; \/\/ folder icon\r\n\t\techo '&lt;span class=\"folder-name\"&gt;&lt;a href=' . $server . '\/' . $folder . '&gt;' . $folder . '&lt;\/a&gt;&lt;\/span&gt;'; \/\/ folder name and link\r\n\t\techo '&lt;\/li&gt;'; \/\/ close list\r\n\t}\r\n}\r\necho '&lt;\/ol&gt;';\r\n<\/pre>\n<p>Here are a few things that you might want to take note from the above PHP scripts:<\/p>\n<p>1. <code>if ($folder === '.' or $folder === '..' or $folder === 'assets') continue;<\/code>. We use this line to exclude the parents directory, which are presented with dots in Apache server. It also excludes the assets that we use to store CSS and images for customizing <em>localhost<\/em> appearance.<\/p>\n<p>For reference, you can head over to the PHP docs about the <code><a href=\"http:\/\/www.php.net\/manual\/en\/control-structures.continue.php\" rel=\"nofollow\">continue<\/a><\/code> function.<\/p>\n<p>2. The HTML list structure is encapsulated with <code>if (is_dir($cur_dir . '\/' . $folder))<\/code> conditional function, that way it will only output Folders.<\/p>\n<p>Open <code>localhost:8888<\/code> in the Browser, and we will get the following result.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/osx-apache-mysql-php-part-3\/folder-list.jpg\" alt=\"\" width=\"500\" height=\"320\"><\/figure>\n<h2>Writing the CSS<\/h2>\n<p>Before we start writing CSS, let\u2019s download <a href=\"https:\/\/www.premiumpixels.com\/freebies\/mac-os-folder-file-icons-psd\/\" rel=\"nofollow\">Mac tiny folder icon<\/a> and <a href=\"https:\/\/www.deviantart.com\/simphax\/art\/Mac-OS-X-Leopard-or-Lion-folder-template-100880935\" rel=\"nofollow\">Mac OS X folder<\/a>. Open the files in Photoshop, save the icons in PNG format, and put them inside the \/assets\/img directory.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/osx-apache-mysql-php-part-3\/folders.jpg\" alt=\"\" width=\"500\" height=\"120\"><\/figure>\n<p>Then, create a new stylesheet file in the \/assets\/css directory.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/osx-apache-mysql-php-part-3\/css.jpg\" alt=\"\" width=\"500\" height=\"120\"><\/figure>\n<p>Also, include the link in the <strong>index.php<\/strong> file.<\/p>\n<pre>\r\n&lt;link rel=\"stylesheet\" href=\"assets\/css\/style.css\"&gt;\r\n<\/pre>\n<h3>Basic Styles<\/h3>\n<p>First let\u2019s put the basic styles for the HTML elements. These include setting the box sizing to <code>border-box<\/code>, so we can easily decide and measure the size of the element. We also set the font-family, and display the HTML list inline.<\/p>\n<pre>\r\n*, *:before, *:after {\r\n  box-sizing: border-box;\r\n}\r\nhtml {\r\n  font-family: \"Lucida Grande\", \"Lucida Sans Unicode\", \"Lucida Sans\", Tahoma, sans-serif;\r\n  text-align: center;\r\n}\r\nbody {\r\n  margin: 0;\r\n  padding: 0;\r\n}\r\nol, ul {\r\n  padding: 0;\r\n  margin: 0;\r\n}\r\nol li, ul li {\r\n  display: inline-block;\r\n  margin: 0 20px;\r\n}\r\nol a, ul a {\r\n  text-decoration: none;\r\n  color: #000;\r\n}\r\n<\/pre>\n<p>Please note that we omit the browser vendor prefix to make the codes shorter. But we have included it in the source code that you can download at the end of this tutorial.<\/p>\n<h3>Page Header<\/h3>\n<p>We will mimic the OS X color scheme to make the appearance fit well. So, for the page header, we will give it a gradient with a gray color scheme and put the tiny icon aside.<\/p>\n<pre>\r\n.site-header {\r\n  height: 30px;\r\n  width: 100%;\r\n  background: linear-gradient(to bottom, #eeeeee 0%, #cccccc 100%);\r\n  box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.6);\r\n  line-height: 2.5;\r\n  margin-bottom: 50px;\r\n}\r\n.site-header h1 {\r\n  color: #000;\r\n  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);\r\n  font-size: 0.8em;\r\n  font-weight: 400;\r\n  margin: 0;\r\n}\r\n.site-header h1:before {\r\n  content: url('..\/img\/folder-sm.png');\r\n  display: inline-block;\r\n  width: 16px;\r\n  height: 16px;\r\n  margin-right: 7px;\r\n  position: relative;\r\n  top: 2px;\r\n}\r\n<\/pre>\n<h2>The Folders<\/h2>\n<p>Next, we display the OS X folder on the list items that we have generated with PHP, previously. The following CSS codes also include the styles when we hover the folder.<\/p>\n<pre>\r\n.site-folder {\r\n  position: relative;\r\n  width: 145px;\r\n  height: 132px;\r\n}\r\n.site-folder .folder-icon {\r\n  display: block;\r\n  height: 100%;\r\n  width: 100%;\r\n  background-image: url('..\/img\/folder-128.png');\r\n  background-repeat: no-repeat;\r\n  background-position: center top;\r\n  border-radius: 5px;\r\n  text-indent: 100%;\r\n  white-space: nowrap;\r\n  overflow: hidden;\r\n}\r\n.site-folder .folder-icon:hover {\r\n  background-color: rgba(0, 0, 0, 0.1);\r\n}\r\n.site-folder .folder-icon:hover + .folder-name {\r\n  background-color: #2b5dcd;\r\n}\r\n.site-folder .folder-icon:hover + .folder-name a {\r\n  color: #fff;\r\n}\r\n.folder-name {\r\n  border-radius: 24px;\r\n  font-weight: 400;\r\n  font-size: 0.8em;\r\n  text-transform: lowercase;\r\n  display: inline-block;\r\n  margin-top: 10px;\r\n  padding: 5px 12px;\r\n}\r\n<\/pre>\n<p>We are done. The screenshot below shows the final result when we view <code>localhost:8888<\/code> in the browser.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/osx-apache-mysql-php-part-3\/final-result.jpg\" alt=\"\" width=\"500\" height=\"350\"><\/figure>\n<h2>Conclusion<\/h2>\n<p>We have completed the series that came in 3 installments. To sum up:<\/p>\n<ol>\n<li>In the first part, we have <a href=\"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-1\/\">set and configured PHP and Apache<\/a>.<\/li>\n<li>Then, we installed MySQL and manage it with Sequel Pro, in the second part.<\/li>\n<li>In this tutorial, which is the last part, we customized the folder presentation in <em>localhost<\/em>.<\/li>\n<\/ol>\n<p>We hope that you find these tutorials useful. If you have any question regarding to the topic discussed, feel free to put your question in the comment box below.<\/p>","protected":false},"excerpt":{"rendered":"<p>This is the last part of our series: Install PHP, Apache, and MySQL in Mac without MAMP. And if you have been following the series (see Part 1 and Part 2 here) and have created projects in ~\/Sites, then access localhost:8888 in the Browser, you will find that they are displayed as shown in the&hellip;<\/p>\n","protected":false},"author":113,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3400],"tags":[2987,4656,254,1319],"topic":[4520,4521],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Easy Mac Setup: Install PHP, Apache &amp; MySQL - Part III - Hongkiat<\/title>\n<meta name=\"description\" content=\"This is the last part of our series: Install PHP, Apache, and MySQL in Mac without MAMP. And if you have been following the series (see Part 1 and Part 2\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Easy Mac Setup: Install PHP, Apache &amp; MySQL - Part III\" \/>\n<meta property=\"og:description\" content=\"This is the last part of our series: Install PHP, Apache, and MySQL in Mac without MAMP. And if you have been following the series (see Part 1 and Part 2\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2014-02-28T15:01:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-03T17:42:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/assets.hongkiat.com\/uploads\/osx-apache-mysql-php-part-3\/folder-list.jpg\" \/>\n<meta name=\"author\" content=\"Thoriq Firdaus\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@tfirdaus\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Thoriq Firdaus\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/osx-apache-mysql-php-part-3\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/osx-apache-mysql-php-part-3\\\/\"},\"author\":{\"name\":\"Thoriq Firdaus\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e7948c7a175d211496331e4b6ce55807\"},\"headline\":\"Easy Mac Setup: Install PHP, Apache &#038; MySQL &#8211; Part III\",\"datePublished\":\"2014-02-28T15:01:19+00:00\",\"dateModified\":\"2025-04-03T17:42:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/osx-apache-mysql-php-part-3\\\/\"},\"wordCount\":690,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/osx-apache-mysql-php-part-3\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/osx-apache-mysql-php-part-3\\\/folder-list.jpg\",\"keywords\":[\"Apache\",\"Localhost and Webserver\",\"MySQL\",\"PHP\"],\"articleSection\":[\"Hosting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/osx-apache-mysql-php-part-3\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/osx-apache-mysql-php-part-3\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/osx-apache-mysql-php-part-3\\\/\",\"name\":\"Easy Mac Setup: Install PHP, Apache & MySQL - Part III - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/osx-apache-mysql-php-part-3\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/osx-apache-mysql-php-part-3\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/osx-apache-mysql-php-part-3\\\/folder-list.jpg\",\"datePublished\":\"2014-02-28T15:01:19+00:00\",\"dateModified\":\"2025-04-03T17:42:26+00:00\",\"description\":\"This is the last part of our series: Install PHP, Apache, and MySQL in Mac without MAMP. And if you have been following the series (see Part 1 and Part 2\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/osx-apache-mysql-php-part-3\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/osx-apache-mysql-php-part-3\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/osx-apache-mysql-php-part-3\\\/#primaryimage\",\"url\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/osx-apache-mysql-php-part-3\\\/folder-list.jpg\",\"contentUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/osx-apache-mysql-php-part-3\\\/folder-list.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/osx-apache-mysql-php-part-3\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Easy Mac Setup: Install PHP, Apache &#038; MySQL &#8211; Part III\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e7948c7a175d211496331e4b6ce55807\",\"name\":\"Thoriq Firdaus\",\"description\":\"Thoriq is a writer for Hongkiat.com with a passion for web design and development. He is the author of Responsive Web Design by Examples, where he covered his best approaches in developing responsive websites quickly with a framework.\",\"sameAs\":[\"https:\\\/\\\/thoriq.com\",\"https:\\\/\\\/x.com\\\/tfirdaus\"],\"jobTitle\":\"Web Developer\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/thoriq\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Easy Mac Setup: Install PHP, Apache & MySQL - Part III - Hongkiat","description":"This is the last part of our series: Install PHP, Apache, and MySQL in Mac without MAMP. And if you have been following the series (see Part 1 and Part 2","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/","og_locale":"en_US","og_type":"article","og_title":"Easy Mac Setup: Install PHP, Apache & MySQL - Part III","og_description":"This is the last part of our series: Install PHP, Apache, and MySQL in Mac without MAMP. And if you have been following the series (see Part 1 and Part 2","og_url":"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2014-02-28T15:01:19+00:00","article_modified_time":"2025-04-03T17:42:26+00:00","og_image":[{"url":"https:\/\/assets.hongkiat.com\/uploads\/osx-apache-mysql-php-part-3\/folder-list.jpg","type":"","width":"","height":""}],"author":"Thoriq Firdaus","twitter_card":"summary_large_image","twitter_creator":"@tfirdaus","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Thoriq Firdaus","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/"},"author":{"name":"Thoriq Firdaus","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e7948c7a175d211496331e4b6ce55807"},"headline":"Easy Mac Setup: Install PHP, Apache &#038; MySQL &#8211; Part III","datePublished":"2014-02-28T15:01:19+00:00","dateModified":"2025-04-03T17:42:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/"},"wordCount":690,"commentCount":2,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/osx-apache-mysql-php-part-3\/folder-list.jpg","keywords":["Apache","Localhost and Webserver","MySQL","PHP"],"articleSection":["Hosting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/","url":"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/","name":"Easy Mac Setup: Install PHP, Apache & MySQL - Part III - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/osx-apache-mysql-php-part-3\/folder-list.jpg","datePublished":"2014-02-28T15:01:19+00:00","dateModified":"2025-04-03T17:42:26+00:00","description":"This is the last part of our series: Install PHP, Apache, and MySQL in Mac without MAMP. And if you have been following the series (see Part 1 and Part 2","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/#primaryimage","url":"https:\/\/assets.hongkiat.com\/uploads\/osx-apache-mysql-php-part-3\/folder-list.jpg","contentUrl":"https:\/\/assets.hongkiat.com\/uploads\/osx-apache-mysql-php-part-3\/folder-list.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/osx-apache-mysql-php-part-3\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Easy Mac Setup: Install PHP, Apache &#038; MySQL &#8211; Part III"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e7948c7a175d211496331e4b6ce55807","name":"Thoriq Firdaus","description":"Thoriq is a writer for Hongkiat.com with a passion for web design and development. He is the author of Responsive Web Design by Examples, where he covered his best approaches in developing responsive websites quickly with a framework.","sameAs":["https:\/\/thoriq.com","https:\/\/x.com\/tfirdaus"],"jobTitle":"Web Developer","url":"https:\/\/www.hongkiat.com\/blog\/author\/thoriq\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-53z","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/19441","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/113"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=19441"}],"version-history":[{"count":3,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/19441\/revisions"}],"predecessor-version":[{"id":73660,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/19441\/revisions\/73660"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=19441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=19441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=19441"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=19441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}