Mysql Php And Apache For Mac



Configuring PHP, Apache, MySQL, and Xdebug for PHP development in MAC OS X. This tutorial shows you how to set up PHP on the MAMP (Macintosh, Apache, MySQL, PHP) package, which includes the Apache web server, the MySQL database server, and the PHP engine. MAMP is intended as a PHP development environment for the Mac, which can work seamlessly. Browse other questions tagged apache permissions osx-mountain-lion or ask your own question. The Overflow Blog Podcast 276: Ben answers his first question on Stack Overflow.

Apache, MySQL, and PHP versions that I will setup: Apache: version 2.4.18 (bundled with El Capitan, default) MySQL: version 5.7.15 (installed via Homebrew) PHP: version 5.5.34 (bundled with El Capitan, default) I have no MAMP, XAMPP or any bundled.AMP stack installed on my Mac, so I will have fresh install of MySQL. Start Apache on your Mac. Install and configure Apache, PHP and MySQL on Mac OS X 10.8 Mountain Lion. It needs to be downloaded from the MySQL site. Use the Mac OS X ver. 10.7 (x86, 64-bit), DMG Archive version. Here’s a video showing up to set up a Docker-based tool called DDEV on Mac: “How to set up a Docker-based PHP local development environment for macOS” It’s fast and straightforward.

I have installed Apache, PHP, and MySQL on Mac OS X since Leopard. Each time doing so by hand. Each version of Mac OS X having some minor difference. This post serves as much for my own record as to outline how to install Apache, MySQL, and PHP for a local development environment on Mac OS X Mountain Lion.

I am aware of the several packages available, notably MAMP. These packages help get you started quickly. But they forego the learning experience and, as most developers report, eventually break. Personally, the choice to do it myself has proven invaluable.

It is important to remember Mac OS X runs atop UNIX. So all of these technologies install easily on Mac OS X. Furthermore, Apache and PHP are included by default. In the end, you only install MySQL then simply turn everything on.

First, open Terminal and switch to root to avoid permission issues while running these commands.

Enable Apache on Mac OS X

Note: Prior to Mountain Lion this was an option for Web Sharing in System Prefrences → Sharing.

Verify It works! by accessing http://localhost

Enable PHP for Apache

First, make a backup of the default Apache configuration. This is good practice and serves as a comparison against future versions of Mac OS X.

Now edit the Apache configuration. Feel free to use TextEdit if you are not familiar with vi.

Uncomment the following line (remove #):

Restart Apache:

Install MySQL

  1. Download the MySQL DMG for Mac OS X
  2. Install MySQL
  3. Install Preference Pane
  4. Open System Preferences → MySQL
  5. Ensure the MySQL Server is running
  6. Optionally, you can enable MySQL to start automatically. I do.

The README also suggests creating aliases for mysql and mysqladmin. However there are other commands that are helpful such as mysqldump. Instead, I updated my path to include /usr/local/mysql/bin.

Note: You will need to open a new Terminal window or run the command above for your path to update.

I also run mysql_secure_install. While this isn’t necessary, it’s good practice.

Connect PHP and MySQL

You need to ensure PHP and MySQL can communicate with one another. There are several options to do so. I do the following:

Creating VirtualHosts

You could stop here. PHP, MySQL, and Apache are all running. However, all of your sites would have URLs like http://localhost/somesite/ pointing to /Library/WebServer/Documents/somesite. Not ideal for a local development environment.

To run sites individually you need to enable VirtualHosts. To do so, we’ll edit the Apache Configuration again.

Uncomment the following line:

Now Apache will load httpd-vhosts.conf. Let’s edit this file.

Here is an example of VirtualHosts I’ve created.

The first VirtualHost points to /Library/WebServer/Documents. The first VirtualHost is important as it behaves like the default Apache configuration and used when no others match.

The second VirtualHost points to my dev workspace and I can access it directly from http://jason.local. For ease of development, I also configured some custom logs.

Sample editor for mac. Note: I use the extension local. This avoids conflicts with any real extensions and serves as a reminder I’m in my local environment.

Restart Apache:

This comprehensive process allows us to set a status for any downloadable file as follows:.CleanIt’s extremely likely that this software program is clean. Download watch dogs 2 for mac.

In order to access http://jason.local, you need to edit your hosts file.

Add the following line to the bottom:

I run the following to clear the local DNS cache:

Now you can access http://jason.local.

Note: You will need to create a new VirtualHost and edit your hosts file each time you make a new local site.

A note about permissions

You may receive 403 Forbidden when you visit your local site. This is likely a permissions issue. Simply put, the Apache user (_www) needs to have access to read, and sometimes write, your web directory.

If you are not familiar with permissions, read more. For now though, the easiest thing to do is ensure your web directory has permissions of 755. You can change permissions with the command:

In my case, all my files were under my local ~/Documents directory. Which by default is only readable by me. So I had to change permissions for my web directory all the way up to ~/Documents to resolve the 403 Forbidden issue.

Note: There are many ways to solve permission issues. I have provided this as the easiest solution, not the best.

Install PHPMyAdmin

Unless you want to administer MySQL from the command line, I recommend installing PHPMyAdmin. I won’t go into the details. Read the installation guide for more information. I install utility applications in the default directory. That way I can access them under, in this case, http://localhost/phpmyadmin.

Closing

A local development environment is a mandatory part of the Software Development Process. Given the ease at which you can install Apache, PHP, and MySQL on Mac OS X there really no excuse.

- See more at: http://jason.pureconcepts.net/2012/10/install-apache-php-mysql-mac-os-x/#sthash.TbwD4ABp.dpuf

Php Mysql Apache For Mac

From: http://jason.pureconcepts.net/2012/10/install-apache-php-mysql-mac-os-x/

Installing Apache, PHP, and MySQL on Mac OS X的更多相关文章

Mysql Php And Apache For Mac Os

  1. Install MySQL on Mac OS X——MAC安装MySQL

    很多关于如何安装MySQL的教程已经过时了,或者比必须的步骤复杂得多.这篇教程将展示如何安装MySQL,启动MySQL,以root用户进入MySQL,以及创建删除退出数据库. Step 1: 下载My ..

  2. Mysql On Mac OS: Remove & Install

    If you downloaded and installed from .dmg package already, and mightbe sometime it sucks because of ..

  3. mysql on Mac OS

    在新买的macbook pro15上安装了mysql,发现2个问题 一个是workbench基本无法正常退出,都要force quit 第二是我正常通过workbench连接后,查看系统log,会发现 ..

  4. Mac OS X 配置 Apache+Mysql+PHP 详细教程

    网上的教程已经有很多,这里简洁的记录一下.以 Mac OS X Mavericks 10.9.X 为例. 先附上如何进入指定目录文件夹,按键盘 Command + Shift + G ,然后输入指定目 ..

  5. 在Mac OS X中配置Apache + PHP + MySQL 很详细

    这是一篇超级详细的配置mac os下面php+mysql+apache的文章.非常详细我的大部分配置就是参考上面的内容的,比如,PHP不能连接数据库,就是改一下默认的php.ini中pdo_mysql ..

  6. 在Mac OS X下使用Apache、PHP、MySQL、Netbeans、Yii

    本文环境: Mac OS X:10.8.4 Apache:2.2.22 PHP:5.3.15 Netbeans:7.3.1 Yii:1.1.14 Mac OS X是内置了Apache服务器的,不过默认 ..

  7. 【转】在Mac OS X 10.8中配置Apache + PHP + MySQL

    CHENYILONG Blog 在Mac OS X 10.8中配置Apache + PHP + MySQL 在Mac OS X 10.8中配置Apache+PHP+MySQL的内容包括: 配置Apac ..

  8. PHP初步:在Mac OS X Yosemite下搭建Apache+PHP+Mysql

    Mac OS X是基于unix的操作系统,很多软件都集成在系统中.所以,对于配置PHP的开发环境相对于windows和Linux更简单. 1. 启动Apache服务器 打开终端(terminal),查 ..

  9. Mac OS X取消Apache(httpd)开机启动

    安装MAMP后,启动服务时提示Apache启动失败,80端口被占用.查看进程发现存在几个httpd. OS X自带Apache,可是默认是没有启动的.我也没有开启Web共享,怎么就开机启动了呢? 不知 ..

随机推荐

  1. Centos、Ubuntu 安装 Mono、Jexus

    Mono是.NET的跨平台实现 在众多关于语言的争论中,.NET一直被以不能跨平台而诟病,Mono改变了这一现状. 有人当心Mono会涉及版权啥的问题.高深的偶不懂,不过我觉得Unity3D都能用,为 ..

  2. Spring mvc web.xml中 urlpatten的配置问题

    在使用spring mvc 是我们会配置spring 的DispatcherServlet作为请求的转发器. <servlet> <servlet-name>spring< ..

  3. 在Visualforce page中用自带的控件实现Ajax回调后台方法(并且可以用js去动态给parameters赋值)

    这里用的组合是:apex:commandLink + apex:actionFunction + apex:outputPanel 这里的 apex:commandLink 和 apex:actio ..

  4. PHP通过反射方法调用执行类中的私有方法

    PHP 5 具有完整的反射 API,添加了对类.接口.函数.方法和扩展进行反向工程的能力. 下面我们演示一下如何通过反射,来调用执行一个类中的私有方法: <?php //MyClass这个类中包 ..

  5. 使用Apache Felix Remote Shell远程管理OSGI

    通过Apache Felix Remote Shell提供的org.apache.felix.shell.remote能使用telnet客户端访问远程的[Apache Felix Shell]和[Ap ..

  6. swfupload用法总结

    <script src='${base}/thirdparty/swfupload/swfupload.js' type='text/javascript' ..

  7. 28 ArcMap 运行特别慢怎么办

    小编电脑配置如下: , 虽然不是太好吧,但还是满足ArcMap运行的要求的,但不知道为什么,就是很慢,终于在无意中,发现了一个位置,取消勾选以后,ArcMap变的快很多,亲测有效 取消后台处理后,Ar ..

  8. C++程序设计方法5:接口设计实例

    //例子:旋转方阵填充,要求矩阵大小任意,尺寸在运行时输入 设计思路:从上到下 int main() { cout << 'Please input N:'; int ..

  9. SQL Server 性能优化实战系列(二)

    SQL Server datetime数据类型设计.优化误区 一.场景 在SQL Server 2005中,有一个表TestDatetime,其中Dates这个字段的数据类型是datetime,如果你 ..

  10. hdu 1254(两个BFS) 推箱子

    http://acm.hdu.edu.cn/showproblem.php?pid=1254 首先,要判断人是不是可以从4到达箱子的位置2,而且不止判断一次,因为推动箱子一步后,人的位置也会改变,所以 ..

Windows

This is a list of notable AMP (Apache, MySQL/MariaDB, Perl/PHP/Python) software stacks for all computer platforms; these software bundles are used to run dynamic Web sites or servers. There are LAMPs (for Linux); WAMPs (for Windows); MAMPs (for macOS) and DAMPs (for Darwin); SAMPs (for Solaris); and FAMPs (for FreeBSD).

PackagePlatform
AMPPSWindows, macOS, Linux, BSD
BAMPBSD
BAPPBSD
Bitnami LAMP StackLinux
Bitnami MAMP StackmacOS
Bitnami WAMP StackWindows
DAMPDarwin
FAMP[1]FreeBSD
LAMPLinux
MAMPWindows, macOS
TurnKey Linux LAMP stackLinux (Virtual appliance)
WAMPWindows
WampServerWindows
WIMPWindows
XAMPPWindows, macOS, Linux
Zend Server Community EditionWindows, macOS, Linux, IBMI

Alternate/similar software stacks[edit]

  • LAPP - Linux, Apache, PostgreSQL, Perl/PHP/Python
  • LNMP (aka LEMP) - Linux, Nginx, MySQL/MariaDB, Perl/PHP/Python
  • LLMP - Linux, Lighttpd, MySQL/MariaDB, Perl/Wiki hosting service/PHP/Python

References[edit]

  1. ^Anicas, Mitchell. 'How To Install an Apache, MySQL, and PHP (FAMP) Stack on FreeBSD 10.1'. www.digitalocean.com/community/tutorials/. digitalocean.com. Retrieved 19 April 2015.
Retrieved from 'https://en.wikipedia.org/w/index.php?title=List_of_Apache–MySQL–PHP_packages&oldid=979242658'