PHP move_uploaded_files permission denied

This turned out to be a fairly simple fix after much frustration.

I did this in ssh, so if you don’t have that, you’ll have to find another article.

open ssh, cd to your web root.

type ls -l

to see all the permissions.  You’ll see come stuff like -rw-ww- owner group 4096 time filename

you’ll need to change your upload directory to have the same group and owner as your other web files.

So let’s get started

mkdir data

chown owner

chgrp group

chmod 777 data

That’s it.

replace “data” with your folder name

replace “owner” and “group” to match the settings from when you did ls -l


Getting WordPress to work on GoDaddy’s free hosting account…finally!

Aye….another failed attempt.  Close.   If someone can provide some suggestions, I think we can get there….

Tested in Firefox 3.6.6  Does not work in Chrome.  IE….won’t even try.

It took me a few tries….okay, a bunch of tries, but in the end it’s a really simple fix to get WordPress 3.0 to work on GoDaddy’s free hosting account.

From my experience, I have not had any issues on the front end of wordpress, it is only the admin that breaks.

To fix this, you’ll have to edit some files, but it’s not a big edit.

To get started, open up wp-admin/index.php

Change the top of index.php file to look like this:




* Dashboard Administration Panel

All we’ve done here is add the line ob_start();

Next, at the very, very bottom of that page…I mean the very bottom, put the following code:

$buffer = ob_get_contents();
$buffer = str_replace(array(‘<html>’, ‘</html>’), ”, $buffer);
$handle = fopen(“./temp.html”, ‘w+’);
fwrite($handle, $buffer);
<script type=”text/javascript”>
$(document).ready(function() {
$.get(“./temp.html”, function(data){ $(“html”).append(data); } );
That’s it!
Save that, and refresh your admin index page.
What we have done here is essentially grab all the data that would be output by WordPress before GoDaddy’s get’s is greasy fingers on it, store that in a file.  Then we wait for the entire page to load, let GoDaddy do what they need to do, then wipe the page clean.  We then send out a request to get the non-abducted code and make that your page.  The ole switch-a-roo!
Of course, you probably stopped reading this after you saw that it worked and are now back here reading again to find out why none of the links work. 🙂
Well, we only changed the index.php page.  If you notice in your browser, you are probably now on post.php or edit.php.  This means that each file will need to have the above fix added to it.  I know, so much work, but totally worth it for about a half hour of work.
Caveat: GoDaddy’s puts those ads in there for a reason, so I’d advise to leave them on frontend of your site.  Yeah, I know, I hate them, but hey, a free account for a banner ad, not a bad price to pay.   I took them off my admin for one, because it broke it!, but two because, I’m the admin!!!  They don’t need to advertise to me, I already have an account with them.
-Happy coding!

Magento Nav Function for Dynamic Menus

I finally got tired of messing with Magento Menus.  The drawItem function really sucked when I needed to customize something.

Here is a little function that WORKS!!

function allebrumNav($parentId, $levels=1, $exclude=array(), $current_level=1){
if($current_level == 1){ $menu .= ‘<li><a href=”‘.Mage::getModel(‘catalog/category’)->load($parentId)->getUrl().'”>’.Mage::getModel(‘catalog/category’)->load($parentId)->getName().'</a><ul>’; }
$i = 1;
foreach(Mage::getModel(‘catalog/category’)->load($parentId)->getChildrenCategories() as $cat){
if(!in_array($cat->getId(), $exclude)){
$menu .= ‘<li><a href=”‘.$cat->getUrl().'”>’.$cat->getName().'</a>’;
if($current_level != $levels){ $menu .= ‘<ul>’.allebrumNav($cat->getId(), $levels, $exclude, $current_level+1).'</ul>’; }
$menu .= ‘</li>’;
if($current_level == 1){ $menu .= ‘</ul></li>’; }
return $menu;

To Use the function simple call:

The 1st Parameter is the Parent Category ID to start with. It will start there and read all the children categories.

The 2nd Parameter is how many levels down to read into.

The 3rd Parameter is and array of Category IDs to exclude from the list. Example: array(“32”, “35”, “6”)

Simple Invoice, Gmail/Google Apps, SMTP and PHP

Using Gmail as an SMTP server can be a pain if you don’t know what you are looking for.  Fortunately, there are some decent tutorials online that can get you there….more or less.

I just wanted to recap my experience when trying to use Google Apps as my SMTP server when setting up Simple Invoice…..

1) Get the latest PHPMailer from  Install accordingly.

2) Compile OpenSSL for PHP.  If on windows simply delete the semi-colon (;) in front of ;extension=php_openssl.dll in php.ini

3) When making calls to phpmailer, the host should be ssl://, the port should 465, username should be your full email address and of course your password.   If the phpmailer version requires the input, SMPT_AUTH should be true.

That should be it.

For those using Simple Invoice, you can set your config.ini file to look like this: = ‘ssl://’
email.smtp_auth = true
email.username =
email.password =  password
email.smtpport = 465       =
email.ack     = true

Hope that helps someone.  If you have any questions, just comment and I’ll get back with you.