Now Playing

Archive for the ‘php’ Category

Reloading Apache from within PHP

August 1st, 2008 | apache, php, www | 2 Comments
<?php
exec('echo "/usr/bin/sudo /etc/init.d/httpd reload" | /usr/bin/at now');
?>

There’s a couple of steps to follow to get the above code working as Apache runs on port 80, which requires root priviliges to access. These steps are for Redhat/Centos (tested on Centos 5), but can easily be modified for any distro. You should avoid restarting if at all possible. If you absolutely have to, just replace “reload” with “restart” in the instructions below.

  • Edit your sudoers file and add the following line ( If you are using suPHP/suexec you’ll need to change apache below to your web user ):
    apache ALL= NOPASSWD: /etc/init.d/httpd reload
  • Comment out the following line in your sudoers file
    Defaults requiretty
  • Add the web user to /etc/at.allow to give it access to ‘at’.

That’s it, you should now be able to reload Apache from within PHP using the code segment provided.

FancyUpload 2.0

May 12th, 2008 | javascript, php, www | 1 Comment

Digitarald has updated his FancyUpload script to version 2. I used his first version as the uploader on localhostr and I think I might just update it to use this one.

With the original I had to hack together some json support but it seems this is the default behaviour of the latest release. I love this guy’s work and you should check out the other projects he has, all of which are built on the fantastic mootools. I particularly like Roar notifications which is inspired by Growl, the notification system for Mac OS X.

PHP: Autoloading Objects

February 28th, 2008 | php | 3 Comments

Having only

About

A Web Developer by nature and by trade. Living in Dublin, Ireland and working at Web Reservations International. Enjoys working on Open Source, web server stacks, XHTML/CSS, JavaScript and playing with the latest trends in technology.