Select Page

FAQ’s – How to start stop Apache on a Mac

So this is a very basic FAQ and notes on Apache for Mac

Terminal Commands

Starting: “sudo apachectl start”

Stopping: “sudo apachectl stop”

Restarting: “sudo apachectl restart”

 

Make Apache start when you login to your Mac

 

sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

HOW TO: Stop (most) Automated Comment Spam

Comments  Spam  WordPress

It is easy to stop most WordPress comment spam instantly with one small change to your theme’s functions.php. This is one of my favourite WordPress functions and I use it on all my setups.

This code snippet works by blocking comments from being added offsite or indirectly and not from the comment box on your webpage. Most spammers try to automate their ‘workload’ and try to exploit WordPress functions that allow you to manage comments or add posts via the WordPress API’s.

Just to prove this works … take a look at your spam comments now and mentally calculate your daily average of new spam comments. Then after adding this code to your functions.php file wait for 24 hours … if your spam comments are not down or close to zero you’ve done something wrong.

The role of WordPress Functions.php

Your functions.php file is the place to add snippets of code just like this. It’s found inside your theme folder and the code here runs before your site starts to load. Remember to keep a copy incase you update or replace your theme, this is because the functions.php file is unique to the active theme.

Stop WordPress Comment Spam

Go to your theme folder and open functions.php and insert this code

[php]
//Block Referal URL exploit for Comments
function verify_comment_referer() {
if (!wp_get_referer()) {
wp_die( __(‘You cannot post comment at this time, may be you need to enable referrers in your browser.’) );
}
}
add_action(‘check_comment_flood’, ‘verify_comment_referer’);

[/php]

Do you like this? Did this work for you?

HOW TO: A WordPress update created a fatal error and now I can’t login

You just updated your plugins or theme in WordPress and now you can’t visit wp-admin or visit your website. Everything is broken, what you’re looking at is the White Screen of Death.

It’s easy to recover from the 2 most common errors that kill your WordPress website. Fix the issue in 3 simple steps.

When something goes wrong WordPress the most common cause is a plugin conflict or a problem with your theme. There’s nothing worse then feeling you’ve been locked out from your own website and can’t get to the wp-admin section to login.

WordPress makes it easy to recover from both of these, just rename your older folders and create new empty ones.

One plugin causing you a problem

If you can’t get to login or wp-admin then you know its time to look at the cause.  Typically, WordPress will show error details in your web browser what plugin failed to load or where there was a conflict.

From this error, you know you only have open your FTP program and rename or delete the plugin. WordPress does the rest and removes the plugin allowing you to then login

Can’t login & Can’t access wp-admin pages

If you go to your web pages and are not getting any errors and just a blank screen – WordPress’s white screen of death (WSOD) … its time to fix this.

Root Cause Analysis – Plugins or Themes

What you were recently changing will tell you the next step.

You were just loading or changing themes then you know that you just need to rename / delete the themes folder or if it was a plugin – then dig around and delete that one plugin.

Simple 3 step plan to recover your WordPress website

If you want to be a bit more graceful – you would enable Maintenance mode first – at least your visitors or search bots will know that your temporarily out of action.

  1. Open your FTP program & Navigate to wp-content/
  2. Rename your plugins folder to plugins.old
  3. Create a new folder called plugins

If you know it was a theme conflict then rename follow the same process, but rename themes to themes.old and create a new folder called themes.

Intuitively – WordPress will install its default theme for you and you can login again.

Keep a backup of your WordPress database with DBC Backup 2

Have some confidence and install DBC Backup 2 to automatically backup and save your WordPress database.

This is a WordPress plugin that I manage and maintain.

How to fix your WordPress when read / write doesn’t work

Do you have problems with read / write permissions with WordPress? Are you stuck and can’t upload or change files? If you’ve tried to change the CHMOD values and failed, it might be time to go to the command-line.

Working Alone – Single WordPress site

Run these commands from terminal (command line interface) or ask your web host provider to do this. This will set all files to read/write for the owner and read only for everything else.

[php]
sudo find . -type d -exec chmod 755 {} ;

sudo find . -type f -exec chmod 644 {} ;
[/php]

Run this from inside your WordPress wp-content folder as the . means it will run in on every folder or sub-folder from that . (point).

Working as part of a team – Shared Read/WritePermissions

So that your fellow developers can always help you out it makes sense to have files and folders as group-writable.

Run these commands from terminal (command line interface) or ask your web host provider to do this.

[php]
sudo find . -type d -exec chmod 775 {} ;

sudo find . -type f -exec chmod 664 {} ;
[/php]

Now all you have to do is make sure your team and Apache are all members of the same Server Group.

If you’re trying to update other peoples files you’ll want to run them as Sudo

Links

WordPress.org – Changing File Permissions

How to Show more Posts


It’s very easy to show more posts when browsing WordPress.

Make sure you first View All Posts, then
Select Screen Options from the top right of the Toolbar; and finally
Change the value (eg 200 in the example picture)

How to De-clutter Create Edit Posts


The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box.

Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.