Archive | Small Tips RSS feed for this section
Install PHP mcrypt on UNIX server

Install PHP mcrypt on UNIX server

In this quick tip I’ll show you how to install the PHP extensionmcrypt. This is needed for Magento to run properly otherwise you’ll get an error like: 1Fatal error: Call to undefined function mcrypt_create_iv() in lib/Varien/Crypt/Mcrypt.php on line 64 Install mcrypt on Ubuntu 12# apt-get install php5-mcrypt # /etc/init.d/apache2 restart Install mcrypt on CentOS 12345## 64 [...]

Read full storyComments { 0 }
SQL: Remove HTML with procidure

SQL: Remove HTML with procidure

I had a problem with client’s data that was saved as HTML in the database and I needed it in plain format. Many would say this is very inefficient way of doing it but sometimes desperate time call for desperate measures. And here is my solution to the problem: 123456789101112131415161718192021222324SET GLOBAL log_bin_trust_function_creators=1; DROP FUNCTION IF [...]

Read full storyComments { 0 }
Magento: How to reset admin pssword

Magento: How to reset admin pssword

If you forget your admin password for Magento and you can’t remember the email or just want quick fix you can use one line of SQL to sort that issue out. 1UPDATE admin_user SET password=CONCAT(MD5(’qXpassword’), ‘:qX’) WHERE username=’admin’; All you have to do is replace the “password” with your required one and run the query.

Read full storyComments { 0 }
Serve main domain from subdirectory with .htaccess

Serve main domain from subdirectory with .htaccess

If you are running your site on a shared hosting and you have multiple domain installed as subdirectories the things could go out of hand really fast. In my specific case I have multiple installs of different CMS and one main domain running from “root” directory. What I wanted was to be able to run [...]

Read full storyComments { 0 }
Magento white screen or how XML can break your site?

Magento white screen or how XML can break your site?

I had an odd white screen on one of my websites. No exceptions, no messages, it was time to check the error log. There I found the following error: PHP Fatal error: Call to a member function extend() on a non-object in httpdocs/lib/Varien/Simplexml/Config.php on line 600 That looked very scary like there was some mess [...]

Read full storyComments { 0 }
MySQL – Delete/Drop all tables with specific prefix

MySQL – Delete/Drop all tables with specific prefix

MySQL is great database especially for small and mid size web applications. You can do loads of stuff with it but not everything is possible with regular SQL query. Imagine you have a database and you want to delete set of tables. Most of the database, if not all, I create I use table prefix [...]

Read full storyComments { 1 }
PHP Type Checking

PHP Type Checking

Here’s a quick and dirty utility method for type checking an object or an array of objects. /** * Ensure the object (or the first item in the * array of objects) is of the specified type * or throw an exception * @static * @throws Exception if wrong type * @param $object_or_array * @param [...]

Read full storyComments { 0 }
Force M$ document’s extension and MIME type through .htaccess

Force M$ document’s extension and MIME type through .htaccess

The problem If you use MacOS and Chrome browser (recently this has been reported under other browsers and OS as well) you might have experienced an issue when downloading any Microsoft documents like Word, Excel, PoerPoint their file extension is automatically swapped to “.zip”. The reason for that are the server configurations and more specifically [...]

Read full storyComments { 0 }
Prevent caching of XML files with Apache .htaccess rules

Prevent caching of XML files with Apache .htaccess rules

I am having problems with a dynamically created images.xml being cached in internet explorer. The xml file is used by a flash slideshow player and for different pages on the site, has different images to show. IE isn’t reading the new images.xml each time. I had a go at adding some cache control code to [...]

Read full storyComments { 0 }
Source Code -> Iframe with 100% Height

Source Code -> Iframe with 100% Height

Ever wonder how to create an iframe that fills the entire height (and width) of a page? You probably tried writing something like: 1<iframe width="100%" height="100%"></iframe> and expected the iframe to fill up whatever it could. The width=100% does what you expected and fills up the entire width of the page, but the height just [...]

Read full storyComments { 3 }