Notice: Use of undefined constant MCRYPT_BLOWFISH
Of late there have been a noticeable amount of support requests on freelance websites and on the Magento forums regarding the MCRYPT_BLOWFISH error some users have seenon both Linux and Microsoft servers. Some are effected after server moves and others suggest it is random. Here we are going to take a quick look at the error, why it has happened and how to resolve it.
The reason for the error is actually quite simple and the fix is usually not a massive problem either unless your server is running old or legacy software. The error is caused when PHP cannot find the php-mcrypt module and or the libmcrypt libary.
How to install php-mcrypt and libmcrypt on my Linux server?
First find out which version of PHP you are running and also find out your version of Linux. Once you know your version of Linux you need to lookup how to install programs on there. Usually this will be done with the RPM command, apt-get command or yum install command etc. Then at the command line type (without the hash and replacing apt-get with whatever you installing is, of course) ...
# apt-get install php5-mcrypt
or if you are running php 4 ..
# apt-get install php4-mcrypt
Also if you don't have the library we mentioned ...
# apt-get install libmcrypt
Once you have installed those you will need to restart apache to get them to work. That should be it! If you are having troubles with this then post a comment below and let us know your system specs, we will do our best to help.
How to install php-mcrypt and libmcrypt on my Windows server?
Download libmcrypt.dll from php.net and place it in your PHP directory on your server. This is the directory that usually holds the PHP configuration files and so forth. Now open up php.ini (usually in the same directory, if not then do a Windows search for it) and find the line...
# extension=php_mcrypt.dll
Remove the hash '#' and restart your server and you should be good to go.
Useful Linux Commands
Frequent questions from clients hosted on our Linux servers regarding quick ways to acheive common task to manage their servers and the files on them have prompted this post.
Here are a list of useful server commands that can be used for those of you running Linux servers, and also will mostly work on Unix too. Root access maybe needed for some of these commands depending on your setup.
Change owner of files and directories
# chown -R user /dir/you/choose
-R
If a pathname on the command line is the name of a directory, chown changes all the files and subdirectories under that directory to belong to the specified owner (and group, if :group is specified). If chown cannot change some file or subdirectory under the directory, it continues to try to change the other files and subdirectories under the directory, but exits with a non-zero status.
Set permissions of all directorys, not files
find . -type d -exec chmod 777 {} \;
The above command changes permissions of all sub directories under the current directory... and doesn't effect files however. Make sure you cd to your directory first, doing this from / is a bad idea.
Check what processes are eating memory and CPU in Linux or Unix
top
The above command will list the most CPU-intensive processes running on your system in live time, as the processes change so does the information displayed. Newer linux installations also list memory useage on the same screen. You can delay the live updates if its all a bit fast by adding the -d flag.. for example, to delay screen updates by 10 seconds use:
top -d 10
More useful commands coming soon ... If you wish to request a command, please do so.
Magento Gets 40% Faster to Load
As boasted by Varien, Magento absolutely is a "platform for growth" however if like us you have been continually disappointed with the performance on a speed point of view from Magento 1.2 then there is good news. On March the 30th 2009 Magento announced the release of 1.3 and claimed that they have improved performance by 40% in both page loading time and memory usage. Keen to see this for our selfs, we loaded a fresh 1.3 installation with around 1,200 products yesterday and at first glance the catalog pages are much faster to load than in 1.2.
Additionally in 1.3 there is the option to use a 'flat' category type for databases of under 1,000 products which should improve performance again for smaller stores.
Magento 1.3 is still not lightening speed, though 1.3 is still quite a young release. Magento is certainly still a fantastic product and one to watch for the future.
Spam Sending Clients on Shared Cpanel Servers
Recently one of our reseller Cpanel clients on one of our shared servers managed to have the shared server IP blacklisted in two popular blacklists by sending out spam email using an automated mailing script. As you may know, when one client gets a shared IP blacklisted all clients on that IP are then effected so this was a priority case for us.
Believe it or not many of the most popular blacklists such as SpamCOP are more than happy to remove an IP as a spam source providing you can prove you are not a spam trader. Some of the blacklists you must manually request an IP to be removed however others will automatically remove an IP if it does not get any complaints or trap any spam from it within a number of hours.
Tips to Recover from your Shared Cpanel Server Blacklisting
- Of course the first step was to remove the offending auto mailing script and shutdown the said client's hosting account. Done.
- Next, search the blacklists for your shared IP. There are some good free tools out there to help you with this. Such as MX Toolbox.
- Contact each blacklist your IP appears in and advise you have taken steps to remove your offending client and increase mail security. Await further instruction from each blacklist.
On Spam Prevention using WHM
As the shared IP in question here belonged to a WHM server we run, we will cover some WHM settings that could go a long way in the fight against clients who like to spam.
Load up WHM as root and click through to Main >> Server Configuration >> Tweak Settings and scroll down to mail. There are two very useful settings here.
The maximum each domain can send out per hour
This is quite self explanatory, set it to a low number rather than the default of 0 which is unlimited and each domain is seriously halted when it comes to sending bulk mails.
Prevent the user "nobody" from sending out mail to remote addresses
Some poorer auto mailing scripts will send mail out as the user nobody, set this setting to enabled and this decreases the risk too.
We hope these notes can be of use to individuals and companies alike in the ongoing fight against spam.
