By default vBulletin uses PHP to deal with attachment downloads. It means that to provide a file from forum attachments to a user PHP process reads it and then starts to output it. This would work OK if you don’t have too much users. But if you do, attachments downloads from PHP could become one of…
AWK: how to get text which is between two strings
If you need to get some text which is in file between two lines you could use awk for this. You may need it while analyzing access logs to fix some issue, for instance. Here’s how you could do it: awk ‘/2012:00:20:49/, /2012:00:35/’ access_log > output It’s a simple and convenient way.
Apache: getting remote IP when working behind nginx
Sometimes you may want to use Apache behind nginx. In this case nginx works as reverse proxy and handles user connections and static files. And Apache generates dynamic content (for instance, with use of PHP). In this case remote IP in your scripts would be 127.0.0.1 since Apache gets requests from the same server. It…
MySQL: how to fix ‘ERROR 2006 (HY000) at line ##: MySQL server has gone away’
If you get mentioned error while restoring big database, make sure you have enough size of max_allowed_packet. [mysqld] max_allowed_packet=64M After adding it to your /etc/my.cnf restart MySQL server to apply changes.
MySQL: ERROR 1005 (HY000) at line 14: Can’t create table ‘example.tbl’ (errno: 150)
If you get an error ERROR 1005 (HY000) at line 14: Can’t create table example.tbl (errno: 150) it could be for at least two reasons. MySQL doesn’t allow to create foreign keys for a set of tables one of which doesn’t exist. To solve this restriction you can set SET foreign_key_checks to 0: mysql> SET…
RPM: how to get changelog from package
Often there’s a need to get changelog of RPM package. Here is a way to do that: [root@playground ~]# rpm -qp –changelog kernel-2.6.41.9-1.fc15.x86_64.rpm | head * Fri Jan 13 2012 Josh Boyer <jwboyer@redhat.com> 2.6.41.9-1 – Linux 3.1.9 – CVE-2012-0045 kvm: syscall instruction induced guest panic (rhbz 773392) * Wed Jan 11 2012 Josh Boyer <jwboyer@redhat.com>…
phpMyAdmin: how to use it with several MySQL servers
If you have several MySQL servers it makes sense to use one phpMyAmin to manage them. To do it just add as many server as you need to config.inc.php. In Fedora and Centos it is located in /etc/phpMyAdmin/. Here’s an example: <?php /* Servers configuration */ $i = 0; /* Server: localhost [1] */ $i++;…
nginx: Using fcgiwrap for CGI applications deployment
From the box nginx doesn’t support CGI applications deployment since CGI is very old and poor performance way to run them. But some applications still should be deployed with use of CGI (earlier, we covered setup of Nagios and OTRS with nginx). Here is another way to do that. In this case we will use…
Bind: how to get statistics information
To get statistics information about query numbers that Bind has served you need to add next line to configuration file: statistics-file “/var/stats/named.stats”; It should be added in a ‘global’ options statement. After that you need to restart Bind and run: rndc stats Bind will dump statistics to this file. Note that if you run Bind…
munin: fixing ‘Can’t locate object method “new” via package “LWP::UserAgent” ‘
If you get next message Can’t locate object method “new” via package “LWP::UserAgent” at /usr/share/munin/plugins/nginx_request line 106. when you are installing nginx plugins for munin in Debian, this means that you don’t have perl LWP library. Installing it fixes an issue: apt-get install liblwp-useragent-determined-perl After munin-mode restart munin will start to create graphs.