Sunteți pe pagina 1din 21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

COOLEST GUIDES ON THE


PLANET
NeilGee

Searchtheplanet...

Get Apache, MySQL, PHP and


phpMyAdmin working on OSX
10.11 El Capitan

Subscribetothe
LatestPosts
Add in your email address...

November19,2015 196Comments
Keep Me Posted!

Get your Local Web Development EnvironmentUp


& Running on OSX 10.11 El Capitan
WithApplesnewOSX10.11El
Capitannowinpublichereishow

Coolest Guides on the Plane


1,397 likes

togettheAMPstackupand
runningonthenewOSX.This

Like Page

tutorialwillgothroughtheprocess
ongettingApache,MySQL,PHP

Be the rst of your friends to like this

(orotherwiseknownastheAMP
stack)andphpMyAdminrunning
onthenewElCapitanOS.

Coolest Guides on the Planet


link.
March 6

ThistutorialsetsuptheAMPstackinmoreofatraditionalwayusing
theloadedApacheandPHPanddownloadingMySQLand
phpMyAdminthishasbeenupdatedtoreflect10.11.1andanew
MySQLinstallation.

Setting Stuff Up

Installing PEAR on OSX 10.11 El

WebSharing/Apache
LATEST

WebrootSystemandUserlevel

POPULAR

COMMENTS

RemoveMySQL

.htaccessoverridesandmodrewrites
https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

instancefrommacOS

1/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development


orOSXviathecommandline

PHP

SetUpLetsEncrypt
SSLoncPanelWHM
Server

MySQL

Comparethediffof2
foldersinthe
CommandLine

phpMyAdmin

iOSIPSWFirmware
DownloadLinks9.3.4,

Permissions

9.3.3,9.3.2,9.3.1,
9.3.0,9.2.1,9.2.0,9.1.0,9.0.2,
9.0.1,9.0.0,8.4.1,8.4,8.3,8.2,
8.1.3,8.1.2,8.1.1,8.1.0,8.0.2,
8.0.1,8,7.1.2,7.1.1,7.1,7.0.6,

Apache/WebSharing

7.0.5,7.0.4,7.0.3,7.0.2,7.0.1,
7,6.1.3,6.1.2,6.1,6.0.1,6,
5.1.1,5.1,5.0.1
GetApache,MySQL,

TheirisnoGUItotoggleWebSharingonoroffinOSX10.11,which

PHPandphpMyAdmin

waspreviouslyaGUIoptioninSystemPreferenceswaybackin10.7,
butfearnotApacheisinstalledreadytobefiredup.

workingonmacOS
Sierra

ThisneedstobedoneintheTerminalwhichisfound
at/Applications/Utilities/Terminal
ForthosenotfamiliarwiththeTerminal,itreallyisntasintimidating
asyoumaythink,oncelaunchedyouarefacedwithacommand
promptwaitingforyourcommandsjusttype/pasteinacommand
andhitenter,somecommandsgiveyounoresponseitjustmeans
thecommandisdone,othercommandsgiveyoufeedback.
Usingtheprefixofsudoisrequiredforcommandsthathavetheir
applicationsprotectedincertainfolderswhenusingsudoyouwill
needtoconfirmwithyouradminpasswordoriCloudpasswordifset

Tags

upthatway.letsgettoit.

apache

tostartApachewebsharing

backupbasebandBing

CoolestGuy
onthePlanet
boot

Coolest

csscustom
databasedrupalelcapitanerror
GuyPlanet cpanel

sudo apachectl start

Googleimage
instadmgiosiphone
Firmware

tostopit

jailbreakkeysKeywordslion
sudo apachectl stop

mysqlOSX

mac

phpprivatepublicRank
RankCheckerrankingredirectremote
rsaSEOSERPSshellssh
terminalTwitterunstoppables
PageRank

torestartit
sudo apachectl restart

Yahoo

TofindtheApacheversion
https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

2/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

httpd -v

TheApacheversionthatcomesinOSXElCapitanisApache/2.4.16

ItWorks!

AfterstartingApachetesttoseeifthewebserverisworkinginthe
HOME
MACOS
WEBDEV
ALL POSTS
CONTACT
browserhttp://localhostyoushouldseetheItWorks!text.
Ifyoudontgetthelocalhosttest,youcantrytroubleshootingApache
toseeifthereisanythingwronginitsconfigfilebyrunning
apachectl configtest

Thiswillgiveyouanindicationofwhatmightbewrong.

Document Root
Documentrootisthelocationwherethefilesaresharedfromthefile
systemandissimilartothetraditionalnamesofpublic_htmland
htdocs,OSXhashistoricallyhad2webrootsoneatasystemlevel
andoneatauserlevelyoucansetbothuporjustrunwithone,the
userleveloneallowsmultipleaccountstohavetheirownwebroot
whilstthesystemoneisglobalforallusers.Itseemsthereisless
effortfromAppleincontinuingwiththeuserlevelonebutitstillcanbe
setupwithacoupleofextratweaksinconfigurationfiles.Itiseasier
tousetheuserleveloneasyoudonthavetokeeponauthenticating
asanadminuser.

System Level Web Root


thedefaultsystemdocumentrootisstillfoundat
http://localhost/
Thefilesaresharedinthefilingsystemat

/Library/WebServer/Documents/

https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

3/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

User Level Root

DonateABeerToThe
CoolestGuides

Theotherwebrootdirectorywhichismissingbydefaultisthe
~/SitesfolderintheUseraccount.Thistakesabitlongertosetup

butsomeusersareveryaccustomedtousingit.
YouneedtomakeaSitesfolderattherootlevelofyouraccount
andthenitwillwork.OnceyoumaketheSitesfolderyouwillnotice
thatithasauniqueiconwhichisathrowbackfromafewversions
older.Makethatfolderbeforeyousetuptheuserconfigurationfile
describednext.
Youhavetomakeafewadditionaltweakstogetthe~/Sitesfolder
HOME
MACOS
WEBDEV
ALL POSTS
CONTACT
backupandrunning.

SitesFolder

Addausername.conffiledunder:
/etc/apache2/users/

Ifyoudontalreadyhaveone(verylikely),thencreateonenamedby
theshortusernameoftheaccountwiththesuffix.conf,itslocation
andpermissions/ownershipisbesttackledbyusingtheTerminal,the
texteditornanowouldbethebesttooltodealwiththis.
LaunchTerminal,(Applications/Utilities),andfollowthecommands
below,firstonegetsyoutotherightspot,2ndonecracksopenthe
texteditoronthecommandline(swapusernamewithyour
accountsshortname,ifyoudontknowyouraccountshortnametype
whoamitheTerminalprompt):
cd /etc/apache2/users

sudo nano username.conf

https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

4/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

Thenaddthecontentbelowswappinginyourusernameinthecode
below:
<Directory "/Users/username/Sites/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>

Permissionsonthefileshouldbe:
-rw-r--r-- 1 root wheel 298 Jun 28 16:47 username.conf

Ifnotyouneedtochange
HOME

MACOS

WEBDEV

ALL POSTS

CONTACT

sudo chmod 644 username.conf

Openthemainhttpd.confandallowsomemodules:
sudo nano /etc/apache2/httpd.conf

Andmakesurethesemodulesareuncommented(thefirst2should
alreadybeonacleaninstall):
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

LoadModule include_module libexec/apache2/mod_include.so

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

Whilstyouhavethisfileopenalsotogetphprunninguncomment.
(MentionedalsointhePHPpartofthearticle).
LoadModule php5_module libexec/apache2/libphp5.so

Andalsouncommentthisconfigurationfilealsoinhttpd.confwhich
allowsuserhomedirectories.
Include /private/etc/apache2/extra/httpd-userdir.conf

https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

5/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

Saveallyourchanges(Control+Oinnano)
ThenopenanotherApacheconfigfileanduncommentanotherfile:
sudo nano /etc/apache2/extra/httpd-userdir.conf

Anduncomment:
Include /private/etc/apache2/users/*.conf

Saveallyourchanges(Control+Oinnano)

HOME

MACOS

WEBDEV

ALL POSTS

CONTACT

RestartApacheforthenewfiletoberead:
sudo apachectl restart

Thenthisuserleveldocumentrootwillbeviewableat:
http://localhost/~username/
Youshouldonlyseeadirectorytreelikestructureifthefolderis
empty.

Override .htaccess and allow URL


Rewrites
Ifyouaregoingtousethedocumentrootat
/Library/WebServer/Documentsitisagoodideatoallowany
.htaccessfilesusedtooverridethedefaultsettingsthiscanbe
https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

6/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

accomplishedbyeditingthehttpd.conffileatline217andsettingthe
AllowOverridetoAllandthenrestartApache.Thisisalreadytaken
careofattheSiteslevelwebrootbyfollowingthepreviousstep.
sudo nano /etc/apache2/httpd.conf

HOME

MACOS

WEBDEV

ALL POSTS

CONTACT

osxhtaccessoverride

AlsowhilsthereallowURLrewritessoyourpermalinkslookclean
notugly.
Uncommentinhttpd.confshouldbeuncommentedonaclean
install.
LoadModule rewrite_module libexec/apache2/mod_rewrite.so

PHP
PHP5.5.29isloadedinthebuildofOSX10.11.1ElCapitanand
needstobeturnedonbyuncommentingalineinthehttpd.conffile.
sudo nano /etc/apache2/httpd.conf

Usecontrol+wtosearchwithinnanoandsearchforphpthiswill
landyouontherightlinethenuncommenttheline(removethe#):
LoadModule php5_module libexec/apache2/libphp5.so

WriteoutandSaveusingthenanoshortcutkeysatthebottom
controloandcontrolx
Reloadapachetokickin

https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

7/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

sudo apachectl restart

ToseeandtestPHP,createafilenameitphpinfo.phpandfileitin
yourdocumentrootwiththecontentsbelow,thenviewitinabrowser.
<?php phpinfo(); ?>

HOME

MACOS

WEBDEV

ALL POSTS

CONTACT

MySQL
MySQLisagainamissingcomponentinOSX10.11andneedsto
bedowloadedfromtheMySQLsiteusetheMacOSX10.10(x86,
64bit),DMGArchiveversion(workson10.11).Thelatestversion
availableisMySQL5.7.9.Thisversioncorrectspreviousissueswith
startingmysqlonbootasApplechangedthelaunchprocessonOSX
Yosemiteonwards.
IfyouareupgradingfromapreviousOSXandhaveanolderMySQL
versionyoudonothavetoupdateit,itwillworkjustwiththesame
startupissue.OnethingwithMySQLupgradesalwaystakeadata
dumpofyourdatabaseincasethingsgosouthandbeforeyou
upgradetoElCapitanmakesureyourMySQLServerisnotrunning.
Whendownloadingyoudonthavetosignup,lookforNothanks,
justtakemetothedownloads!gostraighttothedownload
mirrorsanddownloadthesoftwarefromamirrorwhichisclosestto
you.
Oncedownloadedopenthe.dmgandruntheinstaller.

https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

8/21

23/8/2016

HOME

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

MACOS

WEBDEV

ALL POSTS

CONTACT

RunthestandardinstallwhichwillalsoinstallaSystemPrefPane
andsupportforlaunchingMySQLonboot.
SomethingnewinthelatestversionofMySQLforOSXthatisafter
theinstallyouaregiveatemporarypasswordwhichyouneedtotake
acopyof,youcanchangethatlater.

StartingMySQL
RelaunchyouSystemPreferenceandyouwillseeanewMySQL
Preference,whichyoucanstart/stopMySQLandalsoenabletohave
itlaunchonboot.

https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

9/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

Starting/Stoppingfromthecommandline
ifyouaresoinclined,thestart/stopcommandshavechangedfor
MySQL5.7onOSX
Tostart
sudo launchctl load -F
/Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

Tostop
HOME

MACOS

WEBDEV

ALL POSTS

CONTACT

sudo launchctl unload -F


/Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

TofindtheMySQLversionfromtheterminal,typeattheprompt:
/usr/local/mysql/bin/mysql -v -u root -p

Enter/pasteyourMySQLrootpasswordwhenprompted,thetemp
oneyoucopiedearlier,thisalsoputsyouintoashellinteractive
dialoguewithmySQL,typeqtoexit.
Afterinstallation,inordertousemysqlcommandswithouttypingthe
fullpathtothecommandsyoucanaddthemysqldirectorytoyour
shellpath,(optionalstep)thisisdoneinyour.bash_profilefilein
yourhomedirectory,ifyoudonthavethatfilejustcreateitusingvior
nano:
cd ; nano .bash_profile

export PATH="/usr/local/mysql/bin:$PATH"

Thefirstcommandbringsyoutoyourhomedirectoryandopens
the.bash_profilefileorcreatesanewoneifitdoesntexist,thenadd
inthelineabovewhichaddsthemysqlbinarypathtocommandsthat
youcanrun.Exitthefilewithtypecontrol+xandwhenprompted
savethechangebytypingy.Lastthingtodohereistoreloadthe
shellfortheabovetoworkstraightaway.
source ~/.bash_profile

mysql -v -u root -p

https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

10/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

Youwillgettheversionnumberagain,justtype\qtoexit.

Changethe MySQL root password


NotethatthisisnotthesameastherootoradminpasswordofOSX
thisisauniquepasswordforthemysqlrootuser,useoneand
remember/jotdownsomewherewhatitis.
/usr/local/mysql/bin/mysqladmin -u root -p'temppassword'
password 'newpassword'
Use the single 'quotes' surrounding the password

Fix the 2002 MySQL Socket error


HOME
MACOS
WEBDEV
ALL POSTS
CONTACT
Fixthelooming2002socketerrorwhichislinkingwhereMySQL
placesthesocketandwhereOSXthinksitshouldbe,MySQLputsit
in/tmpandOSXlooksforitin/var/mysqlthesocketisatypeoffile
thatallowsmysqlclient/servercommunication.
sudo mkdir /var/mysql

sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

phpMyAdmin
Firstfixthe2002socketerrorifyouhaventdonesofromtheMySQL
section
sudo mkdir /var/mysql

sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

DownloadphpMyAdmin,thezipEnglishpackagewillsuitalotof
users,thenunzipitandmovethefolderwithitscontentsintothe
documentrootlevelrenamingfoldertophpmyadmin.
Maketheconfigfolder
mkdir ~/Sites/phpmyadmin/config

Changethepermissions
chmod o+w ~/Sites/phpmyadmin/config

Runthesetupinthebrowser
https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

11/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

http://localhost/~username/phpmyadmin/setup/orhttp://localhost/phpmyadmin/setup/

HOME

MACOS

WEBDEV

ALL POSTS

CONTACT

Youneedtocreateanewlocalhostmysqlserverconnection,
clicknewserver.

SwitchtotheAuthenticationtabandsetthelocalmysqlrootuser
andthepassword.
Addintheusernameroot(maybealreadypopulated,addinthe
https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

12/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

passwordthatyousetupearlierfortheMySQLrootusersetup,click
onsaveandyouarereturnedtothepreviousscreen.
(ThisisnottheOSXAdminorrootpassworditistheMySQLroot
user).

HOME

MACOS

WEBDEV

ALL POSTS

CONTACT

Makesureyouclickonsave,thenaconfig.inc.phpisnowinthe
/configdirectoryofphpmyadmindirectory,movethisfiletotheroot
levelof/phpmyadminandthenremovethe
nowempty/configdirectory.

Nowgoingtohttp://localhost/~username/phpmyadmin/willnowallow
youtointeractwithyourMySQLdatabases.

https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

13/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

Toupgradephpmyadminjustdownloadthelatestversionandcopy
theolderconfig.inc.phpfromtheexistingdirectoryintothenew
folderandreplacebackuptheolderonejustincase.

Permissions
Torunawebsitewithnopermissionissuesitisbesttosettheweb
rootanditscontentstobewriteablebyall,sinceitsalocal
developmentitshouldntbeasecurityissue.
LetssaythatyouhaveasiteintheUserSitesfolderatthefollowing
location~/Sites/testsiteyouwouldsetittobewriteablelikeso:
HOME
MACOS
WEBDEV
ALL POSTS
CONTACT
sudo chmod -R a+w ~/Sites/testsite

Ifyouareconcernedaboutsecuritytheninsteadofmakingitworld
writeableyoucansettheownertobeApache_wwwbutwhen
workingonfilesyouwouldhavetoauthenticatemoreasadminyou
arenottheowner,youwoulddothislikeso:
sudo chown -R _www ~/Sites/testsite

ThiswillsetthecontentsrecursivelytobeownedbytheApacheuser.
IfyouhadthewebsitestoredattheSystemlevelDocumentrootat
say/Library/WebServer/Documents/testsitethenitwouldhaveto
bethelatter:
sudo chown -R _www /Library/WebServer/Documents/testsite

Anothereasierwaytodothisifyouhaveaoneuserworkstationisto
changetheApachewebuserfrom_wwwtoyouraccount.
Thatsit!YounowhavethenativeAMPstackrunningontopofOSX
ElCapitan.

Share this:

Twitter

Google

Facebook

Related

https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

14/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

GetApache,MySQL,PHP
andphpMyAdminworking
onOSX10.10Yosemite
In"macOS"

FastestWaytoinstall
WordPressonOSX10.11,
10.10,10.9,10.8,10.7and
10.6
In"macOS"

GetApache,MySQL,PHP
andphpMyAdminworking
onOSX10.9Mavericks
In"macOS"

Cats:macOS,WebDev,WebRoot
Tags:elcapitan

HOME

MACOS

WEBDEV

ALL POSTS

CONTACT

Cmo limpiar el Mac


Sigue estos pasos uno a uno para limpiar tu Mac. Ms informacin!

196 Comments
Recommend 23

Coolest Guides on the Planet

Login

Sort by Newest

Share

Join the discussion


Faizan Ul Haq 7 days ago

I have followed this guide step by step but , localhost/~username is not working :
(

Reply Share
Anglo Phile 16 days ago

Running 10.11.6, I have found that symlinks in my ~/Sites directory are no longer
followed. I am using the same configuration as I have for a few years now, in
which I symlink directories into my ~/Sites directory. However, this is the first
time I have tried to this since ElCapitan, and possibly even Yosemite, so it may be
a known issue.
I have this in my users/pbw.conf:
<directory "="" users="" pbw="" sites="" "="">
Options FollowSymLinks Indexes MultiViews
AllowOverride All
Require all granted
</directory>
so I have clearly updated it since the change to "Require all granted," but have
not tried the symlinks since then.
Does anyone else have this problem?
I have also found, since at least 10.11.5, that php extensions can no longer be
https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

15/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

I have also found, since at least 10.11.5, that php extensions can no longer be
compiled and added because it no longer works to turn SIP off, add the
extension, and restore SIP, as I could earlier. (Apple keeps changing the way
these things work, and to hell with users who are trying to set up development
environments.)

Reply Share
ThreeNineConsulting 21 days ago

Hey thanks for this guide. It helped me a lot. I managed to tweak it a little more
to get exactly what I needed, but this tut got me the fabled 80% there :-)

Reply Share
Boback a month ago

Very useful

Reply Share
Zul Fikar a month ago

Hi I got stack when installed this, if I access the

HOME http://localhost/~username/info.php
MACOS
WEBDEV
ALL
POSTS
CONTACT
is works
normally, but
when I access only:
http://localhost/info.php it said forbidden, any idea how to fix this?
Thanks

Reply Share
Guillaume Lebret 2 months ago

To change the password on El Capitan you should use UPDATE mysql.user SET
authentication_string=PASSWORD('1234') WHERE User='root';

Reply Share
Adm Designhouse 2 months ago

I've been installing according this post but have this ERROR 1045 (28000):
Access denied for user 'root'@'localhost' (using password: YES) with mysql. I was
setting up mysql on completely clean install of mac os x 10.11.5

Reply Share
Adm Designhouse > Adm Designhouse 2 months ago

this error appeared when i tried to change password with


/usr/local/mysql/bin/mysqladmin -u root -p'temppassword' password
'newpassword'

Reply Share
guillomal373 2 months ago

Thank you so much :)

Reply Share
Dan Lablanc 3 months ago

I am having problem with starting up MySQL using the pane. I give the password
nothing happen. Then I tried to start it manually; when I monitor mysqld I see it
keeps changing the PID. Please help.

Reply Share
lore 3 months ago

Having problems setting up Apache to allow server Side Includes. I have included
Includes in the Options section of httpd.conf, but the include statement in my
.shtml file is not resolving.
My options section is:
Options Includes FollowSymLinks Multiviews
MultiviewsMatch Any
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Total n00b here, i'm sure it's something super easy.
https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

16/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

Total n00b here, i'm sure it's something super easy.

Reply Share
Tony Brown 3 months ago

I have a forbidden message when visiting the Sites directory, don't know what
happened, I've followed this tutorial before and everything worked just fine, the
only thing I did differently was install PHP70 from `homebrew`, any
suggestions?

Reply Share
Tony Brown > Tony Brown 3 months ago

Okay, I added the Guest.conf file back and that seemed to do the trick, if
anyone else is experiencing this issue, don't delete the Guest.conf file

Reply Share
Tony Brown > Tony Brown 3 months ago

Still getting forbidden when I visit `http://localhost` but I can


access directories
MACOSlocalhost/test/,
WEBDEV
ALL POSTS
CONTACT
localhost/info.php etc. I changed the permissions
on the Sites directory and everything seems to be in order except
the forbidden error, really strange. This is why I'm a Ruby /
JavaScript / Python developer. Apache is such a pain to setup and
work with but it's a necessary evil, 90% of all sites use a AMP stack

HOME

Reply Share
Billie Heath 3 months ago

I sounds like I am having the same/similiar problem as Nisaa Roberts.


Executing this command, http://localhost/~username/
FoxFire states it cannot connect to the server.
I have checked and rechecked and have not been able to see where I made a
mistake. Can someone give some ideas on what to look at.
2

Reply Share

sajad 4 months ago

Thanks for this awesomeness article Thanks

Reply Share
Bruno Centurio Souza 4 months ago

Congrats! Thanks

Reply Share
Cathy Wimer 4 months ago

I am having the issue as Nisaa Roberts. Can anyone help?

Reply Share
Flor Montanari 4 months ago

Thank you!

Reply Share
gik254 4 months ago

Hi.
I did all the steps for enabling the ~user directories, I checked everything twice,
all the permitions are OK, the ~user/Sites folder exists (with 755 perm.) all look
OK, I restarted apache (both from the Terminal and from the Server.app) a
couple of times, but my Mac OS X 10.11.3 (server upgrade) box, does not want to
serve the user pages.
It responds with the standard 404 error: "The requested URL /~user was not
found on this server." (the / web pages, work OK, only the user pages do not
work)
https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

17/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

work)
Any ideas?

Reply Share
Our Web Media 4 months ago

Just wanted to say thanks for the awesome detailed article! Was flawless!

Reply Share
Nisaa Roberts 4 months ago

Hi all,
I am having the saving problem as Mart.
I am stuck after the last point of the 'Document Root' section.
When I try to view the user level document using http://localhost/~ryanboundy/
I get: safari can't open the page "localhost/~ryanboundy/" because safari cant
connect to the server "localhost".

HOME

MACOS

To confirm:

WEBDEV

ALL POSTS

CONTACT

- I have a 'Sites' folder in the root level of my account (Users/ryanboundy/Sites)


- I added the comments:
<directory users="" ryanboundy="" sites="" ="">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</directory>
- Ichanged permissions
- I uncommented the modules listed and restarted apache
- Apache is running as I get the 'It works' message when I type http://localhost
into my browser.
- When I check permissions it says: -rw-rr 1 root wheel 133
Followed instructions to the letter so no idea why it is not working. Just doesn't
seem to be 'picking up' the Sites folder
Hope someone can help.

Reply Share
Lucas garrido > Nisaa Roberts 4 months ago

hi , try to comment this line again


"LoadModule php5_module libexec/apache2/libphp5.so"
restart apache and look if it work.

Reply Share
John J Taormina > Lucas garrido 3 months ago

ah ok yes so, this is the culprit regarding the


"http://localhost/~username/" issue. I was unable to load the
~/Sites directory index with "LoadModule php5_module
libexec/apache2/libphp5.so" uncommented. Re-commeted it,
restarted apache, and now the ~/Sites directory loads here
http://localhost/~username/

Reply Share
viaChima 4 months ago

Does anyone have a take on integrating PHP v7.x with the mix?
1

Reply Share

viaChima 4 months ago

Anyone care to share info on adding PHP v7.x to the mix?


1

Reply Share

https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

18/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development


woetter 5 months ago

Everything went fine until phpmyadmin setup


Did everything you described, but when I finally go to login, it returns this error
"#1045 - Access denied for user 'root'@'localhost' (using password: YES)"
1

Reply Share
Wazap > woetter 4 months ago

This step solved this for me (amongst dozen of tutorials) :


/usr/local/mysql/bin/mysqladmin -u root -p'temppassword' password
'new password'
Change 'temp & new password' accordingly to yours.
Cheers

Reply Share
Anthony Scioli 5 months ago

HOME

"TrsTone:users TrsTone$ sudo apachectl -k restart

MACOS

WEBDEV

ALL POSTS

CONTACT

AH00112: Warning: DocumentRoot [/usr/docs/dummy-host.example.com] does


not exist
AH00112: Warning: DocumentRoot [/usr/docs/dummy-host2.example.com]
does not exist
AH00526: Syntax error on line 52 of /private/etc/apache2/extra/httpd-ssl.conf:
Invalid command 'SSLCipherSuite', perhaps misspelled or defined by a module
not included in the server configuration"
I am at a loss. I just want the web server to work so I can exchange files and
access them.
I thought that I followed all the steps.
Now I no longer get "it works" when putting local host into the browser.
When I try to look at line 52 I get permission denied:
"TrsTone:users TrsTone$ cd /etc/apache2/users
TrsTone:users TrsTone$ /private/etc/apache2/extra/httpd-ssl.conf
-bash: /private/etc/apache2/extra/httpd-ssl.conf: Permission denied"
Can anyone help me, Please

Reply Share
Tony Brown > Anthony Scioli 3 months ago

you can always use something like MAMP, configuring a local server isn't
for everyone

Reply Share
Alex Corzo 5 months ago

Thanks for such detailed post!

Reply Share
Bob Rumsby 5 months ago

Thanks for writing this. I found all of it very helpful.

Reply Share
Clgiral 5 months ago

Hello, In terminal (IMac with french keyboard) the command proposed to create
a php phpinfo file is not accept by terminal : syntax error "near unexpected token
'(' . Does somebody have a clue for this parenthesis not accepted? Another
problem is that when asking in terminal my version of Mysql with the line of
command proposed in this tutorial the answer is that it is a directory ?? Am
baffled. Thanks for your help
https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

19/21

23/8/2016

baffled. Thanks for your help

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development

Reply Share
Clgiral > Clgiral 5 months ago

Sorry to have post so rapidly. I just resolve everything by doing every


thing all over again as mentioned in this tutorial. Well thanks really
because it is so easy.

Reply Share
Clgiral 5 months ago

Finally it was easy to correct. In fact all the uncommented files in the httpd.conf
had been commented again. Don't know why, maybe by installing El Capitan. If it
mays help somebody else..

Reply Share
Clgiral 5 months ago

Hello
I'have install and make work Apache Php Mysql and Wordpress site fairly well on
HOME
MACOS
WEBDEV
ALL POSTS
CONTACT
my iMac under Yosemite, thanks to your tutorial. But after some months away
from my computer and having updated to El Capitan I can't access it anymore. I
can access localhost ("It works") but not anything else not
localhost/~myusername/, not even index php and of course not wordpress
anymore. I try in terminal to make the sudo apachectl config test: answer is
"syntax ok". Apache is running. Mysql is running. Do you have an idea of how I
could begin to check what's wrong? Without redoing all over again the whole
configuration? Thanks of any tip.

Reply Share
Tony Brown > Clgiral 3 months ago

mysql status
that command will print out the status of your mysql instance.
Also Stack Overflow has many answers

Reply Share
Kim 5 months ago

I'm working with El Capitan Server using builtin Apache & PHP I'd like to use
Server App for my Websites. I've installed MySQL, phpMyAdmin I'm able to
create databases and users in phpMyAdmin. What I'm having issues with is
getting Wordpress to install. I changed the info in the wp-config.php file to those
in the phpMyAdmin (database & user Name) and when I try to run
http://localhost/wordpress/wp-admin/ or http://localhost/wordpress/wpadmin/install.php (I've also tried it with 127.0.0.1 instead of localhost) all I get is
a blank page. Please help.

Reply Share
Mart Phlepaom 5 months ago

i've googled a lot about my issue, and most of them telling the same thing here.
Only your page explains very clearly, yet i still get the same error on both of my
Macs using El Capitan. The "localhost" works perfectly fine. I can see "It works!"
result, but "localhost/~McC" (my username) doesn't. I believe i followed every
single steps and wrote everything right, but the issue still occur even if i start to
config apache on a fresh new computer which also used with El Capitan. I also
tried to install MAMP. I changed the root, but it only show result of the file in
"Sites" folder when i type "localhost", and it shows error when i type
"localhost/~McC" or access any other file in the "Sites" folder. Can someone help
me?

Reply Share
https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

20/21

23/8/2016

Apache, MySQL, PHP on OSX 10.11 El Capitan for Local Development


Tony Brown > Mart Phlepaom 3 months ago

Did you change your Document Root in the /etc/apache2/httpd.conf file


to /Users/yourname/Sites

Reply Share
Jhonatan Petronilho > Mart Phlepaom 4 months ago

I have same problem. You found solution? Thanks!

Reply Share
Jhonatan Petronilho > Jhonatan Petronilho 4 months ago

I fix my problem.
In /private/etc/apache2/httpd.conf on line 90 have one typing
error.
But not know if is your problem too.
Thanks!

HOME

Reply Share

MACOS

WEBDEV

ALL POSTS

CONTACT

Tony Brown > Jhonatan Petronilho 8 days ago

Yes I fixed the problem a long time ago

Reply Share
Mahesh Damodhar > Mart Phlepaom 5 months ago

Hi Mart,
Is there a "Sites" folder in your home folder? /Users/McC/Sites/
I believe, El Capitan has them removed. Take another close read of the
section "Document Root" on this post. That should help you fix it.
I also realised that your apache isn't running in the background. The
safari screenshot indicates that.

Reply Share
Mart Phlepaom > Mahesh Damodhar 5 months ago

I think i have a hint about what goes wrong now. I reset everything
back to default, and start to config it over again. This time i keep
checking if the apache is running, and i see that apache was
running all a long before i uncommented those commends. But it
stopped running after i uncommented those commends in both
files. i restarted apache, nothing happened. However, when i
forced to restart the apache by "sudo apachectl -k restart", i got
this error replied "httpd not running, trying to start". It says the
service is already loaded when i start the apache again.
can you tell what might be wrong here?

Reply Share
Nisaa Roberts > Mart Phlepaom 4 months ago

Mart, how did you reset everything back to default?

Reply Share

Copyright2016NeilGeeAllRightsReservedHostedbyServint

https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/

21/21

S-ar putea să vă placă și