php


Segmentation Fault using Zend Server with SSL and Curl

Using the apache module mod_ssl and the php extension curl may result in apache not running. Usually there's something like this in the logs: seg fault or similar nasty error detected in the parent process It took me quite a while to figure out how to get this working nevertheless, perhaps I can save someone else's time!! […]


Installing and using libapache2-mod-geoip on Debian

  Installation & Configuration: Install the the needed packages: apt-get update apt-get install -y geoip-bin geoip-database libgeoip-dev libgeoip1 libapache2-mod-geoip  The installation normally enables the new module directly. If this is not the case for whatever reason, just enabled it by executing: a2enmod geoip Before restarting Apache, we need to adapt the module's configuration file /etc/apache2/mods-available/geoip.conf as […]


Installing Nginx with PHP5-FPM on Debian

Install PHP5-FPM as described here. Install Nginx: apt-get install nginx Check for the correct path to the socket used by php5-fpm in /etc/php5/fpm/pool.d/www.conf (to be used in the nginx configuration): listen = /var/run/php5-fpm.sock Create a virtual host in /etc/nginx/sites-available/: server {         listen   80;          root /var/www;       […]


Installing php5-fpm on Debian

First of all, we get the server key: cd /tmp wget http://www.dotdeb.org/dotdeb.gpg cat dotdeb.gpg | apt-key add – Then we update the sources.list file so apt will find the packages: echo "deb http://packages.dotdeb.org squeeze all" >> /etc/apt/sources.list echo "deb-src http://packages.dotdeb.org squeeze all" >> /etc/apt/sources.list Or for Debian Wheezy: echo "deb http://packages.dotdeb.org wheezy all" >> /etc/apt/sources.list echo […]


Convert a string from camelcased to underscored and vice versa in PHP

// underscored to upper-camelcase  // "my_test_method" -> "MyTestMethod"  preg_replace('/(?:^|_)(.?)/e',"strtoupper('$1')",$string);  // underscored to lower-camelcase  // "my_test_method" -> "myTestMethod"  preg_replace('/_(.?)/e',"strtoupper('$1')",$string);  // camelcase (lower or upper) to underscored  // "myTestMethod" -> "my_test_method"  // "MyTestMethod" -> "my_test_method"  strtolower(preg_replace('/([^A-Z])([A-Z])/', "$1_$2", $string));


Mass Virtual Hosting with mod_rewrite RewriteMap and PHP

Here is a simple possibility to control a lot of virtual hosts using a simple PHP script to map them to the right path. First of all you need to make sure that mod_rewrite is loaded: a2enmod rewrite   Further we need these packages: php5-cli php5-mysql mysql-server   What we're doing now is a simple Url-Rewriting […]