The following tutorial is done with Debian Squeeze version 6.0.2.
In this tutorial, I will show you the shortest and easiest way to set up nginx  with PHP5, MySQL and phpmyadmin running through FastCGI:

Step 1: Installation:

apt-get install nginx mysql-server mysql-client php5 php5-cgi php5-mysql phpmyadmin

NOTE: After you have installed all above you will need to edit the php.ini file:
Open php.ini file end remove the ; in front of the line cgi.fix_pathinfo=1

Step 2: Make PHP FastCGI daemon listening on port 9000 on localhost and start at boot.

Edit the /etc/rc.local file and put the following content:

vim /etc/rc.local
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid

Step 3: Create virtual host file for your site:

Continue Reading…

If you discovered that proxying your webserver with varnish breaks PhpMyAdmin I’ve got the solution:

Problem is that the backend webserver, apache2 or nginx doesn’t even know it’s running behind another software.

Varnish does a completely normal request to webserver. Most times this isn’t any problem at all.

PhpMyAdmin tries to be “smart” and figure out its absolute URL and I run the apache2 or nginx backend on port 80.

The solution is to force an URL.

Add the following line to “config.inc.php“, changing the obvious:

$cfg['PmaAbsoluteUri'] = 'http://yourdomain.com/phpmyadmin/';

Enjoy!

Log Files:
Log files are critical to managing Apache.
Managing these logs can provide advance security warnings, provide detailed information in terms of who is visiting your site and where they are coming from and can help you troubleshoot the use of your server resources. The two main log files are listed below from a Debian Squeeze Server.
The access_log file gives you information on who is using your web server and the error_log provides information for troubleshooting.

/var/log/apache2/access_log
/var/log/apache2/error_log

How to View Apache2 Logs:

View apache2 logs with tail and head:

The basic tail command will show the tailend of the log.

tail /var/log/apache2/access_log

You can use the -n option to view a specific number of lines  like in this example:

tail -n100 /var/log/apache2/access_log

Head is the opposite of tail.

Continue Reading…

eAccelerator is a free open-source PHP accelerator & optimizer. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution. eAccelerator typically reduces server load and increases the speed of your PHP code by 1-10 times.

eAccelerator stores compiled PHP scripts in shared memory and executes code directly from it. It creates locks only for a short time, while searching for a compiled PHP script in the cache, so one script can be executed simultaneously by several engines. Files that can’t fit in shared memory are cached on disk only.

The latest release, 0.9.6.1, features support for PHP 5.3 and also works with PHP 5.1 and 5.2.

1. Installation:

apt-get update && apt-get upgrade && apt-get install php5-dev

Now  you  have to download and install eAccelerator from the eAccelerator website.

Now Install eAccelerator using the following commands:

cd /usr/src
wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2
tar -xvfj eaccelerator-0.9.6.1.tar.bz2
cd eaccelerator-0.9.6.1
phpize
./configure
make
make install

2. Integrate eAccelerator in PHP5:

Continue Reading…

There is a simple way to call a simple bash script inside php script page:

- Below is a simple bash script called script.sh

#!/bin/bash
echo “Successful call test script“
exit 0

You will need to set chmod 700 to  be root executable. Then  save the script to your apache root folder.

There is a simple php script called testing.php

< ?php

$script = “/var/www/script.sh”;
$ver1 = system($script, $retval);
if ($retval == 0 ) {
echo “Returned 0″;
}
else {
echo “Returned not zero”;
}
die;

?>

Continue Reading…

Page 5 of 9123456789