Archive

Archive for August, 2008

No space left on device (28) – What to Do if Space Exists

August 30th, 2008 No comments

Today when I logged into one of my ervers I was unable to create a file as I was told that No space was left on device. I checked my discs for free space and found that free space exists on all of my partitions, that’s why I got stuck. I was able to modify my existing files but had no possiblity to create new ones. I even could not start Midnight Commander: it could not create a temporary file.

This usually occurs when your space is used at 100%, but it is quite a rare situation. Most probably you have free space on your partition, but have exceeded the number of files that is allowed to be stored within it.

I cannot tell you what is the number of files permitted, but if you have lots of temporary files, you should really take care of its number. I’d suggest you to delete temporary files when they become unusable as it’s quite hard to detect this issue if you don’t know where they are stored (let’s suppose you have many user accounts and it’s not so easy to detect which of them has a big number of unnecessary files.

Simple Plugin For WordPress to Show Adsense

August 28th, 2008 No comments

Now my blog has one hundred posts. I think my knowledge is worth some money that’s why I decided to add some Ads. All I know is shared absolutely for free and I don’t like any donations. I think Adsense is good enough to monetize my blog. My earnings will be announced; I don’t know what will be the revenue.

I’ve been searching for a good yet simple WordPress plugin, that could allow to add ads to my blog. I’ve tried several, but none of them seemed to be good for my needs. After some experiments I’ve chosen
All in One Adsense and YPN. It was exactly what I needed.

This plugin has only one file, that’s good enough as it is simple to delete it if you decide you don’t need it. The second advantage is the easy setup. Basically, all you need is your adsense publisher ID; all other settings may be left as they are; you need just to select the number of ad blocks and you’re ready to go.  Here is how it looks in my browser:

Everything is clear and easy to set up. I didn’t think adding ads is such an easy task! By the way, plugins I’ve tried were found here:

How To Protect a Folder Using .htaccess From Command Line

August 28th, 2008 No comments

We do often meet password protected directories on the Web. This is usually used to hide some information that should not be visible to all site users. Most common is .htaccess protection, that allows you to restrict users at Apache level and is also knows as http authentification. Today I will tell you how to protect your directory using command line.

As usually we need root access to the server and need to go to the folder which is waiting to be protected. First of all we need to create an .htaccess file that should contain the information that authentification is required to access this folder. The most common sample comes below:

AuthGroupFile /dev/null
AuthName “Closed User Group”
AuthType Basic
AuthUserFile /path_to_htpasswd_file/.htpasswd
require valid-use
r

Usually .htaccess and .htpasswd files are located in the same folder, but you can move .htpasswd anywhere you like: you will just need to point to its absolute location in .htaccess.  Then go to the directory where you’re planning to put your .htpasswd file.

Now we need to have username and password – that’s enough. The following command will create your .htpasswd file with login data so you can use it immediately.

htpasswd -bcm .htpasswd user password

You can read more about this command at Apache Site. But this command will help you to create a password file without any specific knowledge.

Please, note that .htpasswd is just the file name: you’re welcome to store your passwords in the files with any file names, but it would be better if it is started with a dot and if this file is stored in the directory that is not accessible from web.

How to Install Zip Functions Support For PHP

August 25th, 2008 No comments

Using zip files is a common practice for web. Zip archives are very useful as they are supported by all major operating systems and don’t require any special software. XP and Vista have the embedded support of this file format, you won’t also have problems opening these files in Linux. You can also work with these files in PHP. in order to do this, you should have ZZIPlib installed – it allows the easiest way to work with zip archives.

In this article I will tell you how to add zip file support for your PHP installation. As usually, we will need root access to our server with PHP compiled from source files.

In this article I will describe how to add zip support to PHP5 as it is installed at most servers at the moment. My OS is CentOS, but the installation should not differ from other operating systems, it’s easy enough to add zip functions.

First of all we need to ensure we have zlib installed. Run rpm -qa | grep zlib to check whether it is already installed and install it using yum if it is not present in the list created by the output of previous command. yum install zlib* should install everything related to zlib – that’s what we need to run zip.

Then run phpinfo() and copy the configure line you have. It should look like: ./configure –with-apxs –with-curl –with-curl-dir=/usr/local/lib –with-gd –with-gd-dir=/usr/local –with-gettext –with-jpeg-dir=/usr/local/lib –with-kerberos, etc. Then you need to add –enable-zip to this line.

Then you need to go to the directory where PHP source files are located. If you server has Directadmin installed, you should go to /usr/local/directadmin/customapache – your PHP files should be located there. Then change directory to the one with PHP source files and run the configuree command with –enable-zip added. Then – make and make install as usually.

After this all you need is to reboot apache. Your PHP installation should now support zip functions.