Currently Browsing: Tips`n`Tricks

Unable to upload product images in Magento

This is a very rare bug and the chance to experience this problem isn’t very big, but I hope it will save the hair pulling for someone :) The problem manifests itself in products -> edit -> images. There, when you click on the “Browse” button to locate the image on your local...

Magento error — Notice: Undefined index: 0 in app/code/core/Mage/Core/Model/Mysql4/Config.php on line 92

This will most likely occur when migrating Magento from one host to another. The fix, while not so obvious and easy t find turned out to be quite easy ;)  During the installation, Magento sets two IDs to 0 in its database. However, when importing the database dump to your new host, MySQL doesn’t...

Magento ’404 error: Page not found’ fix

The resons for this issue can be quite a few. The issue itself however has the same root in most of the cases. If this error appears, chances are you will nor have access to magento’s admin area either, so reverting the changes which lead to the problem is out of the question. This is literally...

How to create a file of arbitrary size

Sometimes you might need to test certain functionality of a file system, e.g. if quotas are reported correctly. For this purpose you might want to upload a file on the server in specified size. You can easily create such a file using the command below: dd if=/dev/zero of=filename bs=1024 count=1048576 if...

Delete files older than X nuber of days

Here is another bash one-liner. This one will help you find and delete files older than X number of days. Very useful in a directory full of various types of logs, such as /var/log: find .  -type f -mtime +X -exec rm -rf {} \; ;done This assumes, that you are already in the directory in question. Simply...

How to make exim send from a new IP

If you need to send lots of e-mail addresses via your Exim MTA, you will most probably want to do so from a new IP address, so you can preserve your main one. Configuring this is as easy as 1-2-3 :) Open exim.conf for editing with your preferred text editor and find the following lines: remote_smtp: ...

remove only old files from a folder

If you have a directory full of logs for example, I am sure at some point you needed to delete all of them, but the 10 most recent ones. Here is a very short bash one-liner: rm `ls -t | awk 'NR>10'` This will remove all the files from the folder and will leave the 10 most recent ones. The command...

Find the full path to a program

Quite often, when you are installing an application on your host, it asks for the full path to a program. Galleries for example, will need the full path to the convert executable of ImageMagick, some e-commerce scripts need the full path to the curl binary, etc. Of course you can always contact your...

cPanel language

As cPanel is the most popular and widely used hosting control panel, I bet you have used it on at least one of your hosts. Since many of you are not native English speakers, the cpanel developers have added soem additional languages, which you can use, to make the job of maintaining your account a bit...

PHP function test

Most hosting companies today, which offer PHP hosting tend to disable certain PHP functions mostly for security reasons. Contacting support to check if a function is available or not can sometimes be really tough. To save you all this trouble, here is a short script, which will tell you if a function...
Page 1 of 212»