I upgrade to OS X 10.10 Yosemite today form App Store, but my Apache , PHP and MySQL not work well. So I write this post to note my fix method, I wanna this maybe helpful for you.
User Level Root
The other web root directory which is missing by default is the ~/Sites
folder in the User account. This takes a bit longer to set up but some users are very accustomed to using it.
Launch Terminal, (Applications → Utilities), and follow the commands below, first one gets you to the right spot, 2nd one cracks open the text editor on the command line (swap username
with your account's shortname, if you don't know your account shortname type whoami
the Terminal prompt):
$ cd /etc/apache2/users $ sudo nano username.conf
Then add the content below swapping in your username
in the code below:
<Directory "/Users/username/Sites/"> Options FollowSymLinks Indexes MultiViews AllowOverride All Require all granted Allow from all </Directory>
Permissions on the file should be:
-rw-r--r-- 1 root wheel 274 Oct 17 12:47 username.conf
If not you need to change...
$ sudo chmod 644 username.conf
Open the main httpd.conf
and allow some modules:
$ sudo nano /etc/apache2/httpd.conf
And make sure these 3 modules are uncommented (the first 2 should be on a clean install):
LoadModule authz_core_module libexec/apache2/mod_authz_core.so LoadModule authz_host_module libexec/apache2/mod_authz_host.so LoadModule userdir_module libexec/apache2/mod_userdir.so
And also uncomment this configuration file also in httpd.conf
Include /private/etc/apache2/extra/httpd-userdir.conf
Then open another Apache config file and uncomment another file:
$ sudo nano /etc/apache2/extra/httpd-userdir.conf
And uncomment:
Include /private/etc/apache2/users/*.conf
Restart Apache for the new file to be read:
$ sudo apachectl restart
Then this user level document root will be viewable at:
http://localhost/~username/
Upgrade PHP Version via Homebrew
$ brew doctor
If you wanna use Homebrew in OS X, you need install XCode 6.1. Get Xcode 6.1. This a direct download link, but you have to verify a developer account to download. Xcode 6.1 will be available soon in the app store.
After install, do this in terminal:
$ xcode-select --install
Now, you can use Homebrew normally :)
$ brew update $ brew install php55
After upgrade PHP, open /etc/apache2/httpd.conf
, modify
#LoadModule php5_module libexec/apache2/libphp5.so
... to ...
LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so
About MySQL
MySQL can't start automatically on starts up, we can use this command
$ sudo /usr/local/mysql/support-files/mysql.server start
I hope this bug will fix on next release version.
Another way to install MySQL
Apple has enabled a new default security oriented featured called System Integrity Protection, often called rootless, in macOS from versions 10.11 onward. The rootless feature is aimed at preventing macOS compromise by malicious code, whether intentionally or accidentally, and essentially what SIP does is lock down specific system level locations in the file system while simultaneously preventing certain processes from attaching to system-level processes.
While the System Integrity Protection security feature is effective and the vast majority of Mac users should leave rootless enabled, some advanced Mac users may find rootless to be overly protective. Thus, if you're in the group of advanced Mac users who do not want SIP rootless enabled on their macOS installation, we'll show you how to turn this security feature off.
Checking the Status of Rootless / System Integrity Protection in macOS
$ csrutil status
To enable or disable System Integrity Protection, you must boot to Recovery OS and run the csrutil
command from the Terminal.
- Boot to Recovery OS by restarting your machine and holding down the Command R keys keys at startup
- Launch Terminal from the Utilities menu
- Enter the following command
$ csrutil disable
After enabling or disabling System Integrity Protection on a machine, a reboot is required.
Install MySQL with HomeBrew
$ brew install mysql
Start MySQL
$ brew services start mysql
Recommended MySQL Client
Sequel Pro is a fast, easy-to-use Mac database management application for working with MySQL & MariaDB databases.