Ubuntu Server Install PHP 5.3

Posted on Friday, May 21, 2010 in Linux

This is example works on Ubuntu Server 9.04 and PHP 5.3.2
First remove all instances of PHP and related packages

1. add to /etc/apt/sources.list:
deb http://php53.dotdeb.org stable all
deb-src http://php53.dotdeb.org stable all

2. update and upgrade:
#apt-get update && apt-get upgrade

3. install:
#apt-get install php5 libapache2-mod-php5 php5-cli php5-mysql

4. check PHP version:
#php -v

Restart Apache

Ubuntu Package Search

Posted on Thursday, May 20, 2010 in Linux

apt-cache search [package]

Installing APC and eAccelerator for PHP

Posted on Thursday, May 20, 2010 in Linux, PHP

Examples done on Ubuntu 9.04

Installing and Configuring APC:

#apt-get update
#apt-get install php5-dev
#apt-get install php-pear
#apt-get install apache2-threaded-dev
#apt-get install make
#pecl install APC

Add to php.ini:
extension=apc.so
may need to disable zend optimizer (or install as zend optimizer extension)
;zend_extension=/dir/ZendOptimizer.so
Usage:
apc_store("my_key",$obj,3600);
$cached_obj=apc_fetch("my_key");

Installing and Configuring eAccelerator
#cd /tmp/
#wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
#tar xvjf eaccelerator-0.9.5.3.tar.bz2
#cd eaccelerator-0.9.5.3
#phpize
#./configure --with-eaccelerator-shared-memory
#make
#make install
#mkdir /var/cache/eaccelerator
#chmod 777 /var/cache/eaccelerator

add to php.ini:

;eAccelerator configuration
extension="eaccelerator.so"
eaccelerator.shm_size = "16"
eaccelerator.cache_dir = "/var/cache/eaccelerator"
eaccelerator.enable = "1"
eaccelerator.optimizer = "1"
eaccelerator.check_mtime = "1"
eaccelerator.debug = "0"
eaccelerator.filter = ""
eaccelerator.shm_max = "0"
eaccelerator.shm_ttl = "0"
eaccelerator.shm_prune_period = "0"
eaccelerator.shm_only = "0"
eaccelerator.compress = "1"
eaccelerator.compress_level = "9"

Usage:
eaccelerator_put("my_key",serialize($obj),3600);
$cached_obj=unserialize(eaccelerator_get("my_key"));

Restart apache2

Ubuntu Version Command Line

Posted on Thursday, May 20, 2010 in Linux

#cat /etc/issue

Change Subversion Repository UUID

Posted on Wednesday, May 19, 2010 in Linux

Check svn repository uuid:
#svnlook uuid /home/example/project
Example output:
ec932a82-3007-40d5-ad6d-96453a70e36d
Changed svn uuid:
#svnadmin setuuid /home/example/project a17cfs5a-10z3-4c51-a3a6-4d48f69865ca
Check modified uuid:
#svnlook uuid /home/example/project
a17cfs5a-10z3-4c51-a3a6-4d48f69865ca

Remove .svn Directories from Project (recursive)

Posted on Wednesday, May 19, 2010 in Linux

Navigate to project directory and execute:
#find ./ -name ".svn" | xargs rm –Rf

PHP Extend Session Timeout

Posted on Monday, May 10, 2010 in Linux, PHP

Edit session.gc_maxlifetime param in php.ini file:
session.gc_maxlifetime = 1440

Ubuntu Number of Files in Directory

Posted on Thursday, April 29, 2010 in Linux

#ls | wc -l

Ubuntu Save Alias

Posted on Thursday, April 29, 2010 in Linux

Ubuntu (9.04) Edit /etc/bash.bashrc
Add alias lines:
alias z='ls -l'
Logout/login to save/use