PHP Archives

How to find the directory of your WordPress Theme in PHP

To get the directory of the current theme (or child theme) you can use get_stylesheet_directory_uri(). Here’s how to use it. Let’s assume that your WordPress installation lives in http://demo.com, and that your theme is located in a folder named “my-super-theme”. We can assume then that the full URL that points at http://demo.com/wp-content/themes/my-super-theme/ The URL will … Read more

How to upgrade PHP on CentOS 5

With the recent end-of-life announcement it becomes clear that WordPress isn’t going to support PHP 5.1.6. for much longer anymore.

CentOS 5 however comes pre-compiled with PHP 5.1.6 and there are no plans to change this in the current version.

For simple folk like me it’s unimaginable to re-compile the entire OS from source or switch to a different distribution altogether. yum doesn’t help much by default – unless you’re looking in the right repositories.

Help is at hand, courtesy of the 1and1 Knowledge Base. Without further ado, here’s how to upgrade PHP on CentOS 5:

Read more

Linux Disk Space shown as Pie Chart

It's much easier to see a nice diagramme rather than a cryptic line of text from the command line interface

I’m managing a server for Loft London. They’re using it as FTP site for various clients, so I wanted to provide an easy way for them to keep an eye on how much space is used and how much is left.

I’ve done some digging and found this super handy PHP Pie Chart generator by Rasmus Peters. You can call it just like an image, give it some parameters and generate a very cool pie chart diagramme.

My challenge was to use it dynamically by calling the df command on th ecommand line and convert that into a pie chart. Here’s how I did it:

Read more

How to increase the Upload Limit in phpMyAdmin?

Since phpMyAdmin is written in php, all we need to do is change the file upload limit in the php.ini file. On CentOS and RHEL distributions, this file is located in /etc/php.ini Find this section: ;;;;;;;;;;;;;;;; ; File Uploads ; ;;;;;;;;;;;;;;;; ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for … Read more

How to increase your PHP Memory Limit

With certain plugins, you may encounter error messages that tell you your PHP memory limit is not high enough. It usually means: you need more! Like your computer being really slow when you run out of memory, PHP does the same thing, sometimes refusing to work flat out. That’s not so good. There are several … Read more

How to add a Facebook Group Feed

I’ve come acoss this the other day, comes in handy as Facebook Groups don’t have a generic RSS feed. Here’s how you can display what’s new in your favourite groups within your WordPress Site: Make sure you have your Facebook Group ID handy (it’s the last 11 or so numeric digits after the ‘groupid’ tag … Read more