Encoding ASCII Characters in URL – PHP Solution

Sometimes you need to encode the whole URL, not just specific characters that are encoded with urlencode(). You might need to represent your query string or anything else as shown at W3C School. There is quite a simple solution in PHP: <? $string=”some-string”; for ($i=0; $i<strlen($url); $i++) { $mass[$i]=”%”.dechex(ord($url{$i})); } $encoded_string=implode(“”, $mass); ?> In the sample provided the… Read More »

How To Enable Register Globals in PHP Without Access to php.ini

Sometimes you need to use the variables passed to script avoiding usage of superglobal arrays. If you are on shared hosting, you won’t have access to your php.ini file and won’t be able to change register_globals setting. A simple function will help you to do this. <? /** * function to emulate the register_globals setting in PHP *… Read More »

How To Lower Directadmin Server Load

If you’re using Directadmin, you might have noticed that once a day it slows down the server. There is an easy solution to make this run without affecting too much on the server performance. If you wanted to slow down the dataskq, edit: /etc/cron.d/directadmin_cron (or /etc/crontab, depending on your OS) change: Code: * * * * * root… Read More »

How To Install Freetype Support for Your PHP Installation

Today we’ll add Freetype support for your PHP installation. You might need it if you work with GD library and if you want to add text on pictures. Let’s do it together. Starting PuTTY… Let’s install Freetype devel first. You can do that by issuing the following command: yum install freetype-devel. Now we need to configure PHP. Let’s… Read More »

How to Update Webalizer Stats on Directadmin

As you know, Webalizer stats are usually updated once a day, when using a Directadmin server. What to do, if you need more current stats? Here are some solutions (work good for me on CentOS 4). If you need to update all server accounts, just type in the following command as root: echo “action=tally&value=all” >> /usr/local/directadmin/data/task.queue In order… Read More »