Access Forbidden! – XAMPP on macOS Sierra

I just installed a fresh installation of Sierra on my Hackintosh and couldn’t for the life of me get XAMPP to run properly! I got “Access Forbidden” on my localhost and vhosts.I figured I’d write a few notes for people that run into this issue running XAMPP on your Mac. Please comment below if you don’t agree with or see a flaw in my notes and I can test and update your feedback. This guide assumes you already know basics behind XAMPP/WAMP stacks and are stuck getting it running on OSX.

Are they rebranding OSX to macOS? I digress…

Setting Up httpd.conf & httpd-vhosts.conf

1.) Open up XAMPP and click the tab Manage Servers. Highlight Apache and click Configure. Click Open Conf File. This will open your httpd.conf file.

2.) In httpd.conf find the follow line of code and change it daemon to your OS X username.
User daemon

3.) In httpd.conf find the following line and uncomment it (by removing the #)
#Include etc/extra/httpd-vhosts.conf

Save the file, don’t close TextEditor

4.) In TextEditor, goto File -> Open. You should start out in xamppfiles/etc. Click into the extra directory and then open httpd-vhosts.conf

5.) Remove the example code -or- comment all of it out.

6.) Use the following code to base your vhosts on, keep in mind I kept the default localhost example just to access the default htdocs location.

7.) Restart Apache services in XAMPP’s Manage Servers tab.

Solving Access Forbidden in XAMPP

This part is the one thing many would disagree with and I’m not 100% a way around this in macOS Sierra. Previously I’ve simply chmod 644 -R my working folders but I couldn’t for the life of me get around the forbidden error. If you know a better way around this please comment below.

1.) Open Terminal (Applications/Utilities/Terminal)

2.) cd to your directory and give execute read write permissions, example below
$ sudo chmod -R +xrw wordpress/

If you’re new to this, the $ is just signifying the command line beginning and we’re not su. This should set execute/read/write permissions reclusively to all files and folders within our working directory. I haven’t tried it but you can also try chown but these directories are already owned by my user…

Setting Up Hosts File in OSX Sierra

If you’re not familiar with vhosts on a local XAMPP stack, the hosts file allows you to overwrite local DNS routing on your machine. In our scenario, we will one for our local wordpress environment.

1.) In terminal, simply use this command to open up the hosts file:
$ sudo nano /private/etc/hosts

2.) At the bottom of the file add this to your hosts file:
127.0.0.1 wordpress.dev

This will now route traffic from http://wordpress.dev to your localhost. If your httpd.conf and httpd-vhosts.conf files are setup correctly, you can now access your local WordPress developer environment. Try to refresh http://localhost -or- for example http://wordpress.dev

Read More

Bash Script TimThumb Update [cPanel/WHM]

If your dealing with a large WordPress instance, I hope you have shell. Using plugins like Timthumb Vulnerability Scanner on small installations is great, however, on large installations the server might 503.

I had previously used bash scripts to detect outdated TimThumb using simple grep command and outputting the finding to a .txt file which I could cross reference during the update process. It’s become cumbersome to do this, I wanted to grab the updated timthumb version from the Google Code repository and update the files. With a quick Google search, I fould this simple script for cPanel users that can be modified to your distro. Props to DropDeadDick.com for sharing his script. <3 [bash] #! /bin/bash # Detects and updates timthumb.php to latest version for all cPanel users. # dropdeaddick.com latest=`lynx -source http://timthumb.googlecode.com/svn/trunk/timthumb.php |grep "define ('VERSION'" $file |cut -f4 -d"'"` if [ -z "$latest" ]; then echo "could not get latest timthumb release, aborting!" exit 1 fi for user in `awk -F':' '{ if ($3 > 499) print $0 }' /etc/passwd | grep home | cut -d':' -f1`; do for file in `find /home*/$user/public_html/ -type f ( -name 'thumb.php' -o -name 'timthumb.php' ) 2>/dev/null | tr ' ' '%'`; do file=`echo $file | tr '%' ' '` check=`grep -c "code.google.com/p/timthumb" "$file"` if [ -z "$check" ]; then break fi if [ "$check" -gt "0" ]; then version=`grep "define ('VERSION'" "$file" |cut -f4 -d"'"` if [ "$version" != "$latest" ]; then echo -e "e[1;31mWARNING version $versione[0m updating $file!" # rm -f $file #delete current file before replacing. wget -nv -t3 -T3 http://timthumb.googlecode.com/svn/trunk/timthumb.php -O "$file" chown $user: "$file" else echo -e "e[1;32mOK version $versione[0m skipping $file" fi fi done done[/bash] I'd recommend creating an alias so that you can use it periodically. :]

Read More

Inspiration: WordPress Multisite Running On Amazon Web Services

I honestly don’t know why, but I have always feared the day that I would dive head first into Amazon Web Services. In the last two weeks, I have been researching the in’s and out’s of AWS, how people are using it to deploy applications, security, it’s architecture and reading AWS terminology… It is very overwhelming, but I think it’s time I embarked on this adventure.

A few inspirations, Earmilk.com’s Blake Shoji. Although I have never met IRL, nor interacted with him online; the Earmilk network boggles my mind. They definitely sparked my curiosity! If your a music lover, I’d recommend checking them out!

While I was reading up on AWS, I happen to find David Jensen’s blog post on how to install WordPress on Amazon AWS EC2. I am going to use this documentation as a basis for my study, although I do want to branch off to NGINX. We’ll see where the path takes me!

If you need further inspiration that will help motivate you to jump into the cloud, I highly recommend watching “The Known Universe” with The XX Intro Extended dubbed over it. Seriously, the possibilities are endless!

Read More

How To Setup LAMP on uBuntu 11.04 – Also, WordPress

In this article, we will work on setting up a LAMP environment for uBuntu 11.04. As an added bonus, I will setup WordPress 3.2 in the environment for you nerds. As you may notice in previous posts, I have a nice little lappy which allows me to dev on the run.

Installing LAMP onto uBuntu 11.04

First thing is first, we need to install tasksel then run it via terminal.

[code lang=”bash”]
sudo apt-get install tasksel
sudo tasksel[/code]

Select LAMP Server and proceed to install it!

While you are installing LAMP, you will be prompted to set a password for MySQL root.

First of all, /var/www/ directory is set for root user only. We want to allow our IDE’s, such as Netbeans or Vi/Vim/Nano have permissions to write to this directory. So let’s sudo su and chown /var/www/

[code lang=”bash”]
sudo su
chown yourusername:yourusername /var/www/
exit
[/code]

At this point, let’s test to see if LAMP is running.

[code lang=”bash”]sudo vi /var/www/index.php[/code]

Within index.php just enter phpinfo(); to check if the PHP core fires an output!

[code lang=”php”]<?php phpinfo(); ?>[/code]

Save index.php and exit.

When you visit http://localhost/index.php you should get an output. If you do not, you can try restarting apache2 with the following command:

[code lang=”bash”]sudo /etc/init.d/apache2 restart[/code]

Installing phpMyAdmin To Manage Your MySQL Databases on uBuntu 11.04

[code lang=”bash”]sudo apt-get install phpmyadmin[/code]

WordPress: World Famous 5 Minute Installation

Head over to WordPress.org and grab the latest version of WordPress. Extract the zip file to /var/www/wordpress

Visit http://localhost/phpmyadmin and create a database.

Under the Privileges tab, goto Add New User. Make sure under Global Privileges click Check All and hit Go.

Visit http://localhost/wordpress and setup your WordPress install! Bam! Your done!

Read More

Linuxfest Northwest 2011

Arriving at Bellingham Technical College a bit late, tired from late night geeking out on uBuntu. I arrive in a moist parking lot with a grungy overcast. I walk into “Build a Free As In Freedom Cloud” in Haskell 203 late. Old Spice should sponsor Linuxfest, the man next to me smelt of musk; as if he wrestled a bear into submission.

At 11am, Mark Hinkle took the stage discussing “Crash Course on Open Source Cloud Computing” – this man is a genius. Below is his slideshare.

During lunch, of course I opted for the ribs. I met an instructor at WWU and one of the computer science network admins (their names escape me.) It was interesting talking to them about distributed storage.

After lunch I sat in to listen to Adrian Pike’s Agile development concepts and practices for lean startups talk. It was interesting to hear his experience with project management and collaborating with people online. I think the most insightful bit of information was just how their team handles communication. He mentioned Kanban, Scrum, Basecamp, Test suites, etc.

Coincidentally the Amazon AWS talk was canceled. I am not sure why but I ran into two Amazon network technicals hanging out in the hall ways. I had to sit in on a Drupal talk which was semi informative.

The next thing that happened to me was sitting down next to an asian that had a Google Laptop CR-48. I later found out he actually works for Google and was sent to LinuxfestNW to sit in on the Cloud Networking talks. I’m assuming he’s an engineer. He was sitting with one of the Amazon network technicians. David Nalley talk about open source clouds was very informative and I’d love to experiment with the software he mentioned.

All in all, Linuxfest Northwest was just another nerdcore fest. It’s nice to meet / talk with others that understand the techno jargon.

Read More

Learning A New Open Source Platform

In the last 2 weeks, I’ve picked up a new open source platform called MediaWiki. In the past year I’ve been heavily involved with WordPress theme dev and deployment. Learning MediaWiki has quite a learning curve. It seems that webmasters need a greater emphasis on critical thinking, Apache, PHP, MySQL and the basic understanding on how to run a wiki. Luckily the wiki-geek community is vast, people help one another.

The project, Magickapedia.net – is a wiki based on the popular indie game Magicka. The Magicka wiki we founded in the past month has exploded, with over 1,000,000 views in a month. It’s grown so fast, we’ve had to take time to sit down and battle spammers, learn the open source community and implement various features the out-of-the-box code doesn’t offer by default. We are now in the process of preparing for Magicka Vietnam, standardizing templates and refining the content.

2011 is going to be an exciting year.

Read More

Testing mail() On Apache

Updated March 2017: fixed the code to display from gist snippet.

Here is a simple way of testing if your mail() function is working. I’ve used this script to test if the mail servers are properly working. From time to time I’m asked to migrate websites to new DNS’s. When I’m setting up the MX Records, I need to test to make sure the server sends / receives e-mails.

To test outgoing mail using PHP’s mail() function, simply create testmail.php and use this:

Very straight forward, set $to variable to your own e-mail. Edit the $subject and $body if needed. The if conditional will e-mail you if the mail() function exists! Otherwise, you get fail. 🙁

Read More