Tuesday, May 8, 2012

Enabling short PHP open tag

1. Change short_open_tag = On in etc/php.ini.
2. SSH as root and restart server: /sbin/service httpd restart.
3. Enjoy!

Thursday, August 12, 2010

Fixing blurry screenshots on Mac OS X

defaults write com.apple.screencapture type png
killall SystemUIServer

Saturday, May 29, 2010

Sending PHP otput to a file

function ob_callback($buffer) {
global $ob_file;
fwrite($ob_file, $buffer);
}

$ob_file = fopen('test.txt','w');
ob_start("ob_callback");

/* Here goes content. */

ob_end_flush();

Sunday, May 16, 2010

Thursday, May 13, 2010

Copying selected record from one MySQL table to another

In the case of existing table with the same structure:
INSERT table2 SELECT * FROM table1 WHERE [conditions]

Alternative syntax for a table with different structure:
INSERT table2 (columnA, columnB) SELECT column1, column2 FROM table1 WHERE [conditions]

Saturday, May 8, 2010

print_r() output to a file

ob_start();
print_r($array);
$output = ob_get_clean();
file_put_contents("log.txt", $output);

Saturday, May 1, 2010