Category Archives: PHP

FreeBSD, Fatal error: Call to undefined function geoip_country_name_by_name()

Getting Fatal error: Call to undefined function geoip_country_name_by_name() ? Install /usr/ports/net/pecl-geoip # cd /usr/ports/net/pecl-geoip && make install clean # “/usr/local/www/awstats/cgi-bin/” -update -configdir=”/usr/local/etc/awstats/” Error: Plugin load for plugin ‘geoipfree’ failed with return code: Error: Can’t locate Geo/ in @INC (you may need to install the Geo::IPfree module) (@INC contains: /usr/local/lib/perl5/site_perl/mach/5.18 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.18/mach /usr/local/lib/perl5/5.18 /usr/local/lib/perl5/site_perl/5.18 /usr/local/lib/perl5/site_perl/5.18/mach… Read More »

FreeBSD and phpList : White Screen of Death

Despite turning on errors in php.ini I wasn’t getting any error messages when I went to http://ipaddress/lists/ or http://ipaddress/lists/admin/, I just received a white screen of death. After adding error_log() statements thoughout the code to trackdown the issues I discovered that execution was getting as far as line 198 in /lists/admin/init.php ## remember the length of a hashed string… Read More »

PHP and MySQLi SELECT query

<?php $i = new mysqli(‘localhost’, ‘username’, ‘password’, ‘database’); if ($result = $i->query(“SELECT * FROM tablename;”) ) { printf(“Select returned %d rows.\n”, $result->num_rows); if ($result->num_rows > 0) { while ($row = $result->fetch_object()) { print_r($row); } } $result->close(); } else { printf(“%d : %s\n”, $i->errno, $i->error); } ?> if (!$i->query(“INSERT INTO table VALUES(null, ‘x’,’x’,’x’);” ) ) {… Read More »

Category: PHP

Creating PDFs from PHP (Used on PTI and JMS) Never used, but looks interesting.

Category: PHP

htaccess surpress / display PHP errors

# supress php errors php_flag display_startup_errors off php_flag display_errors off php_flag html_errors off php_value docref_root 0 php_value docref_ext 0 # display php errors php_flag display_startup_errors on php_flag display_errors on php_flag html_errors on php_value docref_root 1 php_value docref_ext 1

Vertical text in an image

<?php header (“Content-type: image/png”); // imagecreate (x width, y width) $text = str_replace(‘_’, ‘ ‘, $_GET[‘text’]); $text = ucwords($text); $img_handle = @imagecreatetruecolor (30, 180) or die (“Cannot Create image”); // ImageColorAllocate (image, red, green, blue) $background_color = ImageColorAllocate($img_handle, 0, 0, 0); //to become transparent later in the script $txt_color = ImageColorAllocate($img_handle, 255, 255, 255); //… Read More »

Category: PHP