Fatal error: Unable to read X bytes in file.php

If you got this error Fatal error: Unable to read X bytes in file.php, then:

You have encoded your php files using Zend Encoder and uploaded to the server but gives you this error. This problem occurs due to your FTP software which has ftp’ed your file to the server in ascii mode.

To fix, make sure you upload the file in binary mode and not ascii. This will fix your problem.

Posted in php, zend | Leave a comment

MySQL not loaded in phpinfo()

This instruction is for LAMP technology. For WAMP, I will post later on.

When you have mysql installed in your system, but you do not have mysql.so loaded in your php.ini file. Search for mysql.so in your php extensions directory. If you find it, then simply add mysql.so reference in php.ini. But if you can not find it then remove mysql installation from your system.
After you have removed MySQL completely, look for the php-mysql-5.1.6.rpm in your rpm repository. What this rpm will do is essentially install proper mysql shared object and put the reference to mysql.so in your php.ini.

Make sure you restart Apache server, otherwise the change will not take into effect.

Posted in linux | Leave a comment

How to edit HEX file in VI?

Open the hex file or any file that you want to edit in hex format in “vi“. Lets call that file “myFile.hex”.

To open the file in “vi“, type in terminal “vi myFile.hex

After the file is opened in the “vi“, make sure you are in the command mode. If you are not sure, just hit “ESC” couple of times and it should then be in command mode.

Now type the following “:%!xxd“.

Voila, you are editing the file in hex mode now! Isn’t this awesome?

If you want to revert back to regular editing mode instead of hex mode, then make sure you are in command mode & then type the following “:%!xxd -r“.

This will bring you back to normal editing mode. Isn’t this easy?

Let me know if you have some tricks saved in your sleeves, we can share it here with others.

Posted in Tips | Leave a comment