Short Tag – Web Development Blog

Entries for March, 2013

AES_ENCRYPT and AES_DECRYPT in php

Php doesn’t have direct functions for AES encryption and decryption like MySql.
These functions will do exactly what the MySql functions do.
Encypt function:

function AES_ENCRYPT($value, $secret)
{
return rtrim(
base64_encode(
mcrypt_encrypt(
[...]

Mysql AES_ENCRYPT not working properly

AES_ENCRYPT() is a MySql function for encrypting sensitive data, like passwords.
Usage examples:

SELECT AES_ENCRYPT("string","secret_key");
UPDATE `users` SET `encr_password` = AES_ENCRYPT("string", "secret_key");

The encrypted string will be binary, so it cannot be stored in a regular text field or varchar in MySql.
So, in this case:

UPDATE `users` SET `encr_password` = AES_ENCRYPT("string", "secret_key");

If `encr_password` field’s type is varchar or text then [...]

Can connect but cannot retrieve directory listings – xinetd

After installing the ftp server you can connect to it but cannot retrieve directory listings?
This happens because iptables won’t let you work in passive mode. So you need to load the “ip_conntrack_ftp” module.
You know you have this issue if you disable iptables and the FTP is working correctly.
Edit the following file:
/etc/sysconfig/iptables-config
And put this line anywhere [...]

How to disable XDebug

If you want to disable XDebug on your server for some reason, you can do one of the following:
1.) Locate your php.ini file (the server’s php.ini or if your server allows it create one in the root of your website). Find the following directives and change them as below:

xdebug.remote_autostart=0
xdebug.remote_enable=0
xdebug.profiler_enable=0

2.) Disable it just for one website [...]

FTP not working on Kloxo LxAdmin

I just installed LxAdmin on Centos 5.9 Final and the ftp was not working by default.
I got it working eventually and I share my experience for those who have the same problem.
1.) Firewall
Make sure the firewall has port 21 open.
Open the iptables file: /etc/sysconfig/iptables
You need to have this line in this file, if not include [...]