Category: Articles

rss

mcrypt and PHP 5.3 on Ubuntu Jaunty

My dedicated server still runs on ubuntu jaunty. I wanted to move on to php 5.3 (php 5.2.16 was the final release of the php 5.2 series). The issue is: php 5.3 is not available in jaunty repositories, because it will stay at 5.2.

Installing php 5.3 was simple, just add to:

1
$ vim /etc/apt/sources.list

the following:

1
2
deb http://php53.dotdeb.org stable all
deb-src http://php53.dotdeb.org stable all

Install the dotdeb pgp key:

1
# curl http://www.dotdeb.org/dotdeb.gpg | apt-key add -

Update the apt cache and upgrade php5:

1
# apt-get update
1
# apt-get install php5

But when you want to install phpmyadmin again now, it fails.

1
php5-mcrypt: Depends: libltdl3 (>= 1.5.2-2) but it is not installable

Luckily you can get that (mcrypt) by adding the lenny updates repository manually:

1
# vim /etc/apt/sources.list

add:

1
http://security.debian.org/debian-security lenny/updates main

Install the debian gpg:

1
# gpg --keyserver wwwkeys.eu.pgp.net --recv-keys 9AA38DCD55BE302B

Now update again:

1
# apt-get update

and install php5-mcrypt flawlessly:

1
# apt-get php5-mcrypt

I commented out the new sources.list entries after the install, because I don't need them to be checked on every update.

In Articles, Linux, php & Ubuntu By DracoBlue @ 12:37 19.12.2010

HTTPS + NGINX with self signed SSL certificate

If you want to use https with nginx on your dedicated server, you have the option to buy a certificate. The other way, even though less secure for your clients: create a self signed certificate.

I want to show, how you can create a self signed certificate and how to use it with nginx on an ubuntu linux.

Open a root shell and head to the nginx configuration folder.

1
2
$ sudo -s
# cd /etc/nginx

Generate the self signed certificate and answer the questions.

1
# openssl req -new -x509 -nodes -out server.crt -keyout server.key

Now make the files only visible to the owner (root).

1
# chmod 600 server.key

Add the ssl section as new site:

1
# vim sites-enabled/ssl.example.org

with this code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/server.crt;
ssl_certificate_key /etc/nginx/server.key;

server_name ssl.example.org;

location / {
root /var/www/ssl.example.org;
index index.php;
}

# ... and so on
}

Reboot nginx:

1
# /etc/init.d/nginx restart

Head to your site: https://ssl.example.org. You'll recieve a message in your favorite browser saying that the certificate is insecure, because the author signed it on his own. You have to make an exception.

This does not look very professional. So you should use this procedure only for projects, where you can live with this 'error message'.

In open source, Articles, Linux, Ubuntu & NGINX By DracoBlue @ 12:32 19.12.2010

Configure an Agavi Site with NGINX (using PHP-FPM)

de en

I was used to configure my Agavi site with Lighttpd and recently switched to Nginx. The setup for Nginx was not so common to me, so I decided to write down what I had to do to configure it properly. Here is an example for dracoblue.net. Please change the parts of the script to suit your needs (the necessary parts are highlighted with "HINT:").

First of all install php5-fpm. On ubuntu I did it this way:

1
$ sudo apt-get install php5-fpm

Now create a new file:

1
$ vim /etc/nginx/sites-enabled/dracoblue.net

And add the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
server {
listen dracoblue.net:80;
# HINT: Add the servername, so Agavi is able to see that it's dracoblue.net
# Otherwise you'll get something like "localhost" here
server_name dracoblue.net;

location / {
# HINT: The directory where index.php is
root /home/dracobluenet/tags/1.0.0/pub;
index index.php;

# HINT: All files except those in "static" should be served by index.php
location ~* ^/(favicon.ico|robots.txt|static) {
break;
}

# HINT: All files except those in "static" should be served by index.php
if ($uri !~ "^/(favicon.ico|robots.txt|static|index.php)") {
rewrite ^/([^?]*)$ /index.php?/$1 last;
}
}

location ~ \.php($|/) {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
# HINT: The directory where index.php is + $fastcgi_script_name
fastcgi_param SCRIPT_FILENAME /home/dracobluenet/tags/1.0.0/pub$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
}
}

As you can see, for projects I usually have only a "static" folder which is not served by agavi. This keeps the amount of work low, which nginx needs to do for each request to decide whether it should be served by php or not. I also added robots.txt and favicon.ico since you usually have them in root, too.

Restart nginx.

1
$ /etc/init.d/nginx restart
In Articles, Linux, php, Agavi, NGINX & Lighttpd By DracoBlue @ 13:46 09.12.2010

LFE (sub-woofer) disabled in Ubuntu 10.10 Maveric Meerkat

When I updated to ubuntu 10.10, I had this mysterious problem.

The sub-woofer just worked one time right after I clicked the "5.1 System" in the ubuntu sound options. As soon as a song ended, the sub-woofer was mute again.

I expected this to be an issue of the pulseaudio integration in 10.10. The reason was way simpler!

In 10.10 by default:

1
enable-lfe-remixing = no

is set in

1
/etc/pulse/daemon.conf

Just change this to

1
enable-lfe-remixing = yes

and pulseaudio will mix the 2 channel sound tracks up to the 5 channels including LFE!

In open source, Articles, Linux & Ubuntu By DracoBlue @ 13:00 05.12.2010

Cannot connect to ICQ on Ubuntu Maveric Meerkat

Today I expirienced the issue, that empathy (the ubuntu icq, msn, facebook, ... client) was not able to connect to ICQ anymore.

To fix that issue, just install pidgin ppa (yes, I know you want empathy, but you'll need libpurple to fix it for empathy!).

Then

1
$ sudo apt-get update && sudo apt-get dist-upgrade

You'll see something like:

1
2
Configuring libpurple-bin ein (1:2.7.5-1ubuntu2+pidgin1.10.10) ...
Configuring libpurple0 ein (1:2.7.5-1ubuntu2+pidgin1.10.10) ...

and everything is fine again. Just restart empathy!

Thanks to twenty-three for the hint.

In open source, Articles, Linux & Ubuntu By DracoBlue @ 21:26 18.11.2010

Building/Creating Google Chrome Themes: Manual Reshacker-Way

Google Chrome ships with a folder called theme and a file called default.dll in it.

There are plenty of themes popping up everywhere for the new browser, but actually nearly no documentation on how to make your own.

So the questions are: how to create my own default.dll, how to recompile default.dll or how to change images in default.dll. We won't talk about the second question now, but let's face how to create our own default.dll with changed images in the default.dll-file.

There is a very small and useful tool called ResHacker. Use it and open the default.dll. You'll see plenty of binary data and some icons. While looking at the svn repository of chrome, I noticed that all this files are actually .png files!

So let's have a look at how to replace the "Go"-Button in google chrome. By this table you can see, that the go button has the id 9025. So left click the binary data #9025/1033 and press "Action"->"Save Resource as binary fileÂ? ... " and call the file go.png.

Open the go.png with any image editor you like (even mspaint!). Change it and save it.

Now comes the final steps to add the new go-button:

  1. Press "Action"->"Replace other Resource"
  2. "Open file with new resource" and open the go.png.
  3. Use BINDATA as resource type, 9025 as resource name and 1033 as resource language and press "Replace".
  4. Press "File" -> "Save"
  5. Restart your Chrome Browser!

Now your default theme, should have the new Go-button we just created!

Extracting the files and replacing by hand is a very time intensive way to replace+make themes for google chrome, thatswhy psytoy created 2 batchfiles for automatic extract + replacing of the images in the .dll. So you can create your themes in no time!

In Articles, Windows & Google Chrome By DracoBlue @ 11:53 07.09.2008