Archive for the ‘Apache’ Category

mod_geoip

Tuesday, May 5th, 2009

Found a nice article on how to integrate mod_geoip in PHP.

http://blackonsole.blogspot.com/2009/02/install-and-configure-geoip-on-opensuse.html

wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.5.tar.gz

wget http://geolite.maxmind.com/download/geoip/api/mod_geoip2/mod_geoip2_1.2.5.tar.gz

apxs2 -i -a -L/usr/local/lib -I/usr/local/include -lGeoIP -c mod_geoip.c


IfModule mod_geoip.c

GeoIPEnable On
GeoIPDBFile /usr/local/share/GeoIP/GeoIP.dat

IfModule


$country_code = apache_note("GEOIP_COUNTRY_CODE");
print "Code : " . $country_code . "
";
$country_name = apache_note("GEOIP_COUNTRY_NAME");
print "Country: " . $country_name . "
";

Fix Apache – No space left on device: Couldn’t create accept lock or Cannot create SSLMutex

Monday, July 28th, 2008

When dealing with mem-leaks in my mod_perl-apps I ran into a curious apache-problem. After a while apache could not be started but failed with strange errors like:
[emerg] (28)No space left on device: Couldn’t create accept lock
or
[crit] (28)No space left on device: mod_rewrite: could not create rewrite_log_lock Configuration Failed
or
[Wed Dec 07 00:00:09 2005] [error] (28)No space left on device: Cannot create SSLMutex
There was definitely enough space on the device where the locks are stored (default /usr/local/apache2/logs/). I tried to explicetely different Lockfiles using the LockFile-directive but this did not help. I also tried a non-default AcceptMutex (flock) which then solved the acceptlock-issue and ended in the rewrite_log_lock-issue.
Only reboot of the system helped out of my crisis.
Solution: There were myriads of semaphore-arrays left, owned by my apache-user.
ipcs -s | grep apache
Removing this semaphores immediately solved the problem.
ipcs -s | grep apache | perl -e 'while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}'

Installing Apache 2.x and PHP5

Saturday, March 10th, 2007

Installing Apache 2.x

./configure \
--prefix=/usr/local/apache \
--enable-info \
--enable-rewrite \
--enable-ssl \
--enable-unique-id \
--enable-deflate \
--enable-usertrack \
--enable-so

make
make install


cp build/rpm/httpd.init /etc/init.d/httpd
chkconfig --add httpd
chkconfig --level 3456 httpd on

Installing PHP required Libraries
http://www.ijg.org/files/jpegsrc.v6b.tar.gz
./configure --enable-shared
mkdir -p /usr/local/man/man1
make
make install

http://www.libpng.org/pub/png/libpng.html
./configure
make
make install

http://voxel.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.9.tar.gz
./configure
make
make test
make install

Install LibMCrypt
http://sourceforge.net/projects/mcrypt
./configure
make
make install

Installing PHP5

./configure \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-openssl \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-freetype-dir \
--with-ttf \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-mcrypt \
--enable-mbstring \
--enable-bcmath

make
make install

Configuring Apache for PHP
vi /usr/local/apache/conf/httpd.conf

add
AddType application/x-httpd-php .php

change
DirectoryIndex index.php index.html index.html.var

php.ini
copy php.ini-development or php.ini-production to /usr/local/lib/php.ini

edit /usr/local/lib/php.ini
timezone = Asia/HongKong