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. https://gist.github.com/wykydtronik/8c9e3b701ac138b19a7d012a34d34c6c

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

Are you having troubles with this article? Please feel free to leave a comment below or Tweet me at @eddihughes – I can go through the article and update any steps that may have changed.

Read More

How To Push To Github And WordPress.org

I think this is really important and not many people are aware of this. Evan Solomon deved a tool called Scatter. There are a lot of us that favor utilizing Git > SVN, I feel like SVN is stepping backwards in time. Everyone that is current on Git or started out primarily on git may be turned off by SVN. Welp, kick it in the nuts.

http://evansolomon.me/notes/git-wordpress-plugins-and-a-bit-of-sanity-scatter/

Read More

WordCamp Seattle 2012 – May 19th @ Seattle Art Museum

Seattle, the city of coffee and technology.

This year’s WordCamp Seattle will be held at the Seattle Art Museum in downtown Seattle. I am looking forward to this years WordCamp Seattle since last year we didn’t have one. 🙁 In 2011, I went down to San Francisco to get my fix! I plan on attending a few WordCamps on the west coast in 2012!

If your looking to jump in on the WordPress action, get your tickets today! We’re almost sold out! SOLD OUT!

Who: WordPress Nerdballers
What: WordCamp Seattle 2012
Where:
Seattle Art Museum
1300 1st Avenue, Seattle, WA
(206) 654-3100
How: [Get your tickets here! SOLD OUT!] – If you missed out on a ticket, WordCamp Seattle still needs volunteers! Help out, sign up here: http://2012.seattle.wordcamp.org/volunteer/
Why: Because, CMS.

The WordCamp Seattle 2012 Widget

Spread the word! I just quickly made this widget since WC Seattle hasn’t made one yet!

I am attending WordCamp Seattle 2012

[html]<a href="http://2012.seattle.wordcamp.org" target="_blank"><img title="I am attending WordCamp Seattle 2012" src="http://codesleepshred.com/wp-content/blogs.dir/1/2012/03/wordcamp-seattle-2012.gif" alt="I am attending WordCamp Seattle 2012" /></a>[/html]

Photo credit goes to Doug Mahugh

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

Stepping Into eCommerce With WordPress

It’s time that I take a step into the eCommerce world with a platform that I am most familiar with… WordPress! In the past I’ve helped and tinkered with shopping carts like Magento and have scared away a few small time clients with it’s complexity.

Now, I will be helping clients with the simplicity of WordPress coupled with WooCommerce + WooThemes. I intend on building custom themes based on WooTheme frameworks. Today, I have 2 clients needing website solutions. It’s time to dive into the code!

If you’d like to know more about WooThemes and want a demonstration of WooCommerce, feel free to reach out to me!

Read More

How To Add Options To User Profiles Using personal_options

I wanted to add additional fields / options to the WordPress User Profiles, this would enable users to add their Twitter, Facebook, and Phone Number. Below is a snippet of code you can either add to functions.php or integrate into your WordPress plugin!


<?php // Personal Options
add_action( 'personal_options_update', 'save_custom_profile_fields' );
add_action( 'edit_user_profile_update', 'save_custom_profile_fields' );
function save_custom_profile_fields( $user_id ) {
update_user_meta( $user_id, 'phone_number', $_POST['phone_number'], get_user_meta( $user_id, 'phone_number', true ) );
update_user_meta( $user_id, 'greeting', $_POST['greeting'], get_user_meta( $user_id, 'greeting', true ) );
}
add_filter( 'user_contactmethods', 'add_contact_option', 10, 2 );
function add_contact_option( $user_contactmethods, $user ) {
$user_contactmethods['phone_number'] = 'Phone Number';
return $user_contactmethods;
}
add_action( 'personal_options', 'add_profile_options');
function add_profile_options( $profileuser ) {
$greeting = get_user_meta($profileuser-&gt;ID, 'greeting', true);
?&gt;&lt;tr&gt;
&lt;th scope=&quot;row&quot;&gt;Greeting&lt;/th&gt;
&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;greeting&quot; value=&quot;&lt;?php echo $greeting; ?&gt;&quot; /&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;?php
}

view raw

gistfile1.txt

hosted with ❤ by GitHub

Adding A Drop Down Menu To personal_options

If your curious how to add a select drop down menu, below is an example on how to do this. I hope you find this useful!


<?php // Personal Options
add_action( 'personal_options_update', 'save_custom_profile_fields' );
add_action( 'edit_user_profile_update', 'save_custom_profile_fields' );
function save_custom_profile_fields( $user_id ) {
update_user_meta( $user_id, 'teampage', $_POST['teampage'], get_user_meta( $user_id, 'teampage', true ) );
}
add_action( 'personal_options', 'add_profile_options');
function add_profile_options( $profileuser ) {
$greeting = get_user_meta($profileuser-&gt;ID, 'teampage', true);
?&gt;&lt;tr&gt;
&lt;th scope=&quot;row&quot;&gt;Include On Meet The Team Page?&lt;/th&gt;
&lt;td&gt;
&lt;select name=&quot;teampage&quot; id=&quot;teampage&quot; &gt;
&lt;option id=&quot;Yes&quot;&lt;?php selected( $profileuser-&gt;teampage, 'Yes' ); ?&gt;&gt;Yes&lt;/option&gt;
&lt;option id=&quot;No&quot;&lt;?php selected( $profileuser-&gt;teampage, 'No' ); ?&gt;&gt;No&lt;/option&gt;
&lt;/select&gt;
&lt;/td&gt;
&lt;/tr&gt;&lt;?php
}

view raw

gistfile1.txt

hosted with ❤ by GitHub

How To Remove Default personal_options in User Profiles

Below is a snippet of code that allows you to remove personal_options in the WordPress User Profile.


// Remove Default personal_options
add_filter('user_contactmethods','hide_profile_fields',10,1);
function hide_profile_fields( $contactmethods ) {
unset($contactmethods['aim']);
unset($contactmethods['jabber']);
unset($contactmethods['yim']);
return $contactmethods;
}

view raw

gistfile1.txt

hosted with ❤ by GitHub

Now How Do I Echo This Onto A Page!?

I am assuming you know a little bit about PHP, WordPress Theme development and the API. Below is a function you can use. If you need more info on the_author_meta() and get_the_author_meta() functions please visit the codex. Please feel free to ask a question in comments.


the_author_meta('jobtitle', $authorID);
get_the_author_meta('teampage', $authorID);

view raw

gistfile1.txt

hosted with ❤ by GitHub

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

MySQL Find And Replace In WordPress Database

If you’re migrating domains, changing your alias, or simply learned the hard lessons between your, you’re, you are, here’s a simple mysql query to run on your database.

[box type=”note”]Be sure to backup your database![/box]

You will need phpMyAdmin or SQL Executioner. A basic knowledge in SQL is a must, so run down to Barns & Noble and get your nerd on!

[code lang=”sql”]
update wp_posts set post_content = replace(post_content,’myoldsite.com’,’mynewsite.com’)
[/code]

In this example, we are targeting wp_posts -> post_content. We are performing replace() on anything in post_content that matches “myoldsite.com”.

The basic logic can be applied to anywhere in the database, but this is very useful if for example, all your posts pointed to a site that no longer exists. I’ve also used this to remove author’s contact information in the content. For some reason they thought it was a good idea to include their phone number and e-mail on every post, which later became outdated! I eventually crated a useful author signature and a way they could update this information in /wp-admin/profile.php.

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:


<?php
$to = "test@email.com";
$header = "From: {$to}";
$subject = "Test Subject Here";
$body = "Hi this is a test email to see if the mail() function is working properly on your site.";
if (mail($to, $subject, $body, $header)) {
echo ("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed…</p>");
}
?>

view raw

gistfile1.txt

hosted with ❤ by GitHub

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