dracoblue.net

PhpDebugToolbar 1.3.0 (for agavi) released

Today I am pleased to announce the new version 1.3.0 of the Agavi PHP DebugToolbar for download.

New features include full propel support (thanks tim), rows+time+memory display for the database queries and some small bugfixes.

The source can be found on github now http://github.com/DracoBlue/PhpDebugToolbar, feel free to fork it and send pull request with new features!

Download for PhpDebugToolbar 1.3.0 (just 23KB) is also available here at dracoblue.net.

Short installation and configuration information can be found in the readme. Thanks to all contributors!

In agavi, javascript, open source, php, phpdebugtoolbar, propel by DracoBlue @ 04 Jan 2011 | 86 Words

Mysql with INNODB crashes always on startup

When I upgraded my ubuntu server to a more recent mysql version, the mysql server didn't come up anymore.

The error.log said:

InnoDB: Log scan progressed past the checkpoint lsn 0 726937418
110103 23:55:57  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Error: tried to read 65536 bytes at offset 0 4220416.
InnoDB: Was only able to read 23040.
InnoDB: Fatal error: cannot read from file. OS error number 17.
110103 23:55:57  InnoDB: Assertion failure in thread 140594203866912 in file ../../../storage/innobase/os/os0file.c line 2291
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: about forcing recovery.

The deamon.log only stated:

Jan  3 23:55:57 myhostname init: mysql post-start process (28722) terminated with status 1

On the web I found the hint to add skip-innodb, which didn't help, because I needed innodb for this project.

The solution was (thanks

sr):

# mv /var/lib/mysql/ib* /root/

This moved the inno db index files and after that I restarted mysql and everything was fine again.

# restart mysql

In linux, mysql, ubuntu by DracoBlue @ 04 Jan 2011 | 244 Words

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:

$ vim /etc/apt/sources.list

the following:

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

Install the dotdeb pgp key:

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

Update the apt cache and upgrade php5:

# apt-get update
# apt-get install php5

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

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:

# vim /etc/apt/sources.list

add:

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

Install the debian gpg:

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

Now update again:

# apt-get update

and install php5-mcrypt flawlessly:

# 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 @ 19 Dec 2010 | 230 Words

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.

$ sudo -s
# cd /etc/nginx

Generate the self signed certificate and answer the questions.

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

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

# chmod 600 server.key

Add the ssl section as new site:

# vim sites-enabled/ssl.example.org

with this code:

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:

# /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 articles, linux, nginx, open source, ubuntu by DracoBlue @ 19 Dec 2010 | 240 Words

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

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:

$ sudo apt-get install php5-fpm

Now create a new file:

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

And add the following:

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.

$ /etc/init.d/nginx restart

In agavi, articles, lighttpd, linux, nginx, php by DracoBlue @ 09 Dec 2010 | 287 Words

Page 13 - Page 14 - Page 15

Give something back

Were my blog posts useful to you? If you want to give back, support one of these charities, too!

Report hate in social media Campact e.V. With our technology and your help, we protect the oceans from plastic waste. Gesellschaft fur Freiheitsrechte e. V. The civil eye in the mediterranean

Recent Dev-Articles

Read recently

Recent Files

About