4. December 2014

Problem: Any link on Drupal site shows the same page after upgrade to Apache 2.4 and PHP 5.6

Upgrading old Linux server is challenging task. Many things could break or stop working.

One of problems was that Drupal sites with htaccess file stopped working and any URL was pointing to the same main page.

htaccess file is often use to allow creation of nice URL. It typical content was:

RewriteRule .* %{DOCUMENT_ROOT}/index.php/$0 [L]

This rule is not working with new Apache and PHP. It was necessary to replace it by:

RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Reload Apache and Drupal site should work again.

8. January 2014

The story behind PF2014 – Cordova – slides


Slides available in formats: PDFSlideShare

Web version: http://pf2014.sinusgear.com
Mobile versions: Android, App Store, Amazon
Source code: GitHub

6. January 2014

IntelliJ Idea – Cordova – Default Activity not found! – solution

Situation: import Cordova project with support of Android platform to Intellij Idea. You’re not able to start emulator, because of strange error:

Default Activity not found!

cordova-error-activity-not-found

One solution could be: go to File menu and choose Invalidate Caches /Restart.

This might not help.

The real problem is most likely in configuration of Android module. Open project configuration, select module and make sure that directory src is marked as Source.

cordova-error-add-sources

Confirm module configuration and error message should disappear.

17. December 2013

Debian – upgrade from Apache 2.2 to 2.4 – Starting web server: apache2 failed!

Debian maintainers changed default Apache from version 2.2 to 2.4. Not a big deal?

I was just upgrading one package and it had dependency on whole new Apache. I said yes to upgrade, because I had no bigger issues with Apache upgrade in past.

Wohoo. This upgrade was very funny, because Apache 2.4 was not able to start due to conflicting configurations. The coolest part was that Subversion stopped working, but that’s different story.

The problematic part was that Apache failed to start with nice message:

[FAIL] Starting web server: apache2 failed!
[warn] The apache2 instance did not start within 20 seconds. Please read the log files to discover problems ... (warning)

I checked the log file /var/log/apache2/error.log, but there was no hint what went wrong.

Apache was working even though startup script reported error. 🙂

After a while I found that there were some important changes in /etc/apache2/apache2.conf. I compared this file with /etc/apache2/apache2.conf.dpkg.dist.

It was necessary to update following lines in apache2.conf:

Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
#LockFile /var/lock/apache2/accept.lock - disable this, old value

Then it was possible to start Apache without problem:

[ ok ] Restarting web server: apache2.

7. March 2012

Web stress test by Apache Benchmarking Tool

Sometimes you need to identify bottleneck of web application.

You can use Selenium to record and repeat the same steps over and over.

Another solution is to use Apache Benchmarking Tool.

E.g. You need to send 1000 requests in 10 concurrent threads to localhost:

ab -c 10 -n 1000 http://localhost/

For Debian users: you can find this mighty command in apache2-utils package.

Sample result:

Server Software:        Apache-Coyote/1.1
Server Hostname:        localhost
Server Port:            80

Document Path:          /
Document Length:        405 bytes

Concurrency Level:      10
Time taken for tests:   0.524 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      650000 bytes
HTML transferred:       405000 bytes
Requests per second:    1907.13 [#/sec] (mean)
Time per request:       5.243 [ms] (mean)
Time per request:       0.524 [ms] (mean, across all concurrent requests)
Transfer rate:          1210.58 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2   0.5      2       4
Processing:     0    3   0.5      3       4
Waiting:        0    2   0.7      2       4
Total:          2    5   0.3      5       8