When xdebug is installed, we need to add some configuration to php: Xdebug is essential for all developers, to be able to stop the run of your program midway, inspect the variables and step through the code to find errors (I personally write error-free code, but sometimes I have to debug other people’s code -) ) The last line is for me, a shortcut to “list-long” command. I always add PHP to my profile, to make it globally accessible:Įxport PATH="$(brew -prefix homebrew/php/php71)/bin:$PATH" Save and restart apache with sudo apachectl restartĮdit /etc/hosts to add 127.0.0.1 mysite.isĪnd finally check if mysite.is isn’t showing the headline and the date. ServerAdmin Indexes FollowSymLinks MultiViewsĬreate the folders /Users/YOURUSERNAME/logs and /Users/YOURUSERNAME/workspace (I store all my sites under ~/workspace, you can of course change to whatever you want)Ĭreate an index.php under workspace/mysite.is and put something like this in: Include /usr/local/etc/httpd/vhosts/*.confĬreate the folder /etc/apache2/vhosts and create one vhost file in there (like mysite.is.conf)ĭocumentRoot /Users/drupalviking/workspace/mysite.isĮrrorLog /Users/drupalviking/logs/error.log The secret there was the last line in the config, namely Require all granted, which came in Apache 2.4įind this and uncomment, and add the following lines afterwards The next headache was to get the virtual hosts to work and accept the config. To change that, I changed the line:Īnd in the file /usr/local/etc/httpd/extra/nf My install wanted my server to run on ports 80. Now 7.2 is stable, 7.3 too, but I had difficulty in installing XDebug for 7.3, therefor I have 7.2.īrew install the timezone (/usr/local/etc/php/7.2/php.ini)ĮDIT: These lines are used for Apache, which I haven't installed yet!Įdit nf (/usr/local/etc/httpd/nf)Īdd index.php to DirectoryIndex index.html When I wrote this blog last year, PHP 7.1 was stable and 7.2 still had some issues. We used to have to tap into the PHP kegs, but we don't anymore. Sudo launchctl load /Library/LaunchDaemons/ PHP Sudo chmod -v 644 /Library/LaunchDaemons/ Sudo chown -v root:wheel /Library/LaunchDaemons/ Sudo cp -v /usr/local/Cellar/httpd/2.4.29_1/ /Library/LaunchDaemons/ Sudo launchctl unload -w /System/Library/LaunchDaemons/ 2>/dev/nullīrew install httpd24 -with-privileged-ports -with-http2 Stop the Apache that ships with MacOSX and stop it from restarting EDIT: This does not work for Mojave! Google away Base of the vhosts setup I found here (), but again, I had to do my own version of it to work. For the most of it I followed this blog () but it has dated from the time of writing, so below is my rendering of it, with some additions, mostly regarding vhosts. I had to read many different blogs, git repos and StackOverflow postings in order to get this configuration going like I wanted. Next is to get Homebrew, with this command: ruby -e "$(curl -fsSL )" ApacheĪfter that we start with Apache. … and agree to the license: sudo xcodebuild -license Next step is to install the command line tools: EDIT: Now you can skip this step! Just install the Command Line Tools below And recommended anyway.įirst though, we need to install XCode. I use Homebrew to manage my packages for PHP. Because if I have a hard time remembering it all, most likely some other people could be in the same situation.Īnd even if nobody reads this blog post but me … I still have a good documentation for myself :D Step one: Homebrew, Apache, PHP, XDebug and MySQL I upgraded it, wrote this blog post and I’m now sharing it with you. And luckily I found an old text document with tldr notes from when I was setting my computer up four years ago. So I wiped my computer clean again, to get a fresh start (I did try hours and hours of Googling to figure out how to enable it, without luck). I just can’t work if I can’t use my debugger. For some reasons PHPStorm didn’t catch the XDebug notifications, so I couldn’t debug. Of course I know how to Google, and that’s what I did the last time. And my biggest problems are: I ALWAYS FORGET HOW TO DO IT! :-D PHP, Apache, Mysql, Drush, Composer, Drupal Console, XDebug …. I have so many configurations on my computer, due to the fact that I’m a developer. Sometimes it’s just the time … time to wipe it clean and give it a clean slate.īut that can cause problems. Few weeks ago I was getting fed up with how my computer was set up.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |