Author Archives: alex

Live dump of HTTP request/response headers

Run on the machine in question: live HTTP response headers tcpdump -v -n -S -s 0 -A ‘tcp src port 80′ live HTTP request headers tcpdump -v -n -S -s 0 -A ‘tcp dst port 80′ In case of nginx … Continue reading

Posted in Uncategorized | Tagged | Leave a comment

Making an SSH tunnel to a third machine behind the middle one

ssh -L 8080:host3:80 -N user@host2 Then you can use localhost:8080 to open host2:80

Posted in Uncategorized | Tagged | Leave a comment

Behat: Setting cURL options with Guzzle and Goutte

If when running your Behat tests on a https website you ever seen these errors: [curl] 51: SSL: certificate subject name ‘ubuntu’ does not match target host name ‘mycoolwebsite’ or [curl] 60: SSL certificate problem, verify that the CA cert … Continue reading

Posted in Uncategorized | Tagged , | Leave a comment

Namespaces in PHP

For a while I have not been using namespaces in PHP but the time has come. In this article I mostly explain namespaces to myself but if you find this useful that’s good as well. Working with several projects lately … Continue reading

Posted in Uncategorized | Tagged | 1 Comment

Fixing eAccelerator “open_basedir restriction. in Unknown on line 0″ error

If you are using PHP eAccelerator with open_basedir enabled you could have huge amount of these notices in your PHP log files: open_basedir restriction. in Unknown on line 0 The reason behind it that at the moment eAccelerator tries to … Continue reading

Posted in Uncategorized | Tagged , , | 1 Comment

Chmod files but not directories and vice versa

Files: find top/directory -type f -exec chmod 0644 ‘{}’ \; Directories: find top/directory -type d -exec chmod 0755 ‘{}’ \;

Posted in Uncategorized | Leave a comment

Installing PHP 5.3.3/5.3.4/5.3.5 on Ubuntu 10.04

One other problem I faced recently was a very strange Segmantation fault in unit tests which was very difficult to trace. The problem was fixed by upgrading to PHP 5.3.3. Unfortunately Ubuntu guys are quite slow of updaing packages so … Continue reading

Posted in Uncategorized | Tagged , | 11 Comments

Find and replace contents of files recursively

find ./ -name ‘*.pm’ -exec sed -i -e ‘s/oldtext/newxtext/’ "{}" \;

Posted in Uncategorized | Tagged | Leave a comment

Configuring your OpenVZ containers and backing up using vzdump

The main parameter I’ve toched so far is: privvmpages (Private VM Pages in webvz)- RAM size in memory pages. Usually memory page is 4Kb, so to give your container 256Mb, set it to 65536 (Guaranteed Minimum CPU in webvz) installing … Continue reading

Posted in Uncategorized | Tagged | Leave a comment

Installing and using Openvz & Webvz on Ubuntu 9.04

That worked for me: sudo apt-get install vzctl vzquota   wget http://ftp.fr.debian.org/debian/pool/main/l/linux-2.6/linux-image-2.6.26-2-openvz-686_2.6.26-25_i386.deb   dpkg -i linux-image-2.6.26-2-openvz-686_2.6.26-25_i386.deb Then you need to load into that kernel using grub and you are basically done: alex@ubuntu:~$ uname -r 2.6.26-2-openvz-686 To install webvz then do: … Continue reading

Posted in Uncategorized | Tagged , | Leave a comment