php: image manipulation
Tags: fedora, gd, image, php, ubuntu
the gd image library provide functions to manipulate image files.
on some installations, this does not come as default and needs to be installed.
on fedora, the command is
yum install php-gd
on ubuntu, the command is
sudo apt-get install php5-gd
2008-12-04 10:57:59 • Link • Comments • Trackbacks
php: increase memory limit
Categories: php, unix, apache2
errors like ‘allowed memory size of x bytes exhausted’ or ‘zero size reply’ usually means there’s not enough memory allocated for php. you need to increase the value.
if you have admin access, you can edit /etc/php.ini, locate and update ‘memory_limit’ to values like 16M, 32M, 64M. this change is global to the system. restart apache after update.
if not, add this in php script:
PHP:
ini_set("memory_limit", "32M"); |
2008-10-31 10:21:59 • Link • Comments • Trackbacks
unix time to human readable format
some log files such as squid log uses uses unix time as timestamp, which looks like some random number and doesn’t make sense.
you can use this online conversion tool.
to run from unix command line, to convert to human readable format, eg in yyyy-mm-dd hh:mm:ss format,
Code:
echo <timestamp> | awk '{print strftime("%Y-%m-%d %H:%M:%S", $1);}' |
replace <timestamp> with the unix timestamp. the format for strftime is similar to php function with the same name.
i put this in a shell script so i don’t have to remember the awk command. if there’s a simpler way to do it, please post in comment.
2008-07-18 10:58:05 • Link • Comments • Trackbacks
mediawiki: blank page after install
after installing the lastest version of MediaWiki (V1.12.0), a blank page is displayed when accessing the site.
php error log shows:
PHP Fatal error: Class ‘DOMDocument’ not found in /path/to/wiki/includes/Preprocessor_DOM.php on line 566, referer: http://path/to/wiki/config/index.php
previous versions didn’t have this problem.
this was installed on fedora core 5 server. after some researches, i found that you need to install php-xml component to run (as root):
$ yum install php-xml $ /etc/init.d/httpd restart
i don’t have root access to that particular server, so i found an alternate quick fix. add the following to LocalSettings.php:
PHP:
$wgParserConf['preprocessorClass'] = 'Preprocessor_Hash'; |
2008-07-01 11:57:50 • Link • 3 comments » • Trackbacks
linux server version info
Categories: unix
to find out the ubuntu version the server is running, the information can be found in file /etc/issue.
alternatively, run this command:
$ lsb_release -a
to find out the kernel version, run this command:
$ uname -a
these commands are probably applicable to other linux builds.
2008-05-28 00:22:51 • Link • Comments • Trackbacks
