fgetcsv() in PHP 5.2.4, 5.3.5 and UTF-8

April 13th, 2013

I tried to read a UTF-8 CSV file with fgetcsv(). On my local machine with PHP 5.3.5 it worked without any problem. On the server with PHP 5.2.4 the function kept omitting Chinese characters and instead returned empty strings. I compared the PHP configuration of both machines and adjusted the mbstring options without success. Finally, I changed the LC_CTYPE right before calling fopen(): voila. The server also speaks Chinese. ;-)
setlocale(LC_CTYPE, 'de_DE.utf8');

IAA Plus: Fehlermeldung "Ware(X). Aussenhandelsstatistik Menge.fehlende Pflichtfeld"

Februar 19th, 2013

Link: https://www.ausfuhrplus.internetzollanmeldung.de/iaap

Mein neuer Favorit in der Kategorie "Dreckstool" &#59;) - IAA Plus vom Zoll. Beim Erstellen einer Ausfuhranmeldung ließ sich der o. g. Fehler nicht beseitigen. Er bleibt auch hartnäckig bestehen, wenn man die Warenposition X löscht und wieder neu anlegt. Das Problem tritt im Zusammenhang mit der Warennummer auf: Für die konkrete Warennummer war eine Maßeinheit notwendig, was man auf EZT-Online unter "Ausfuhrmaßnahmen" sehen kann. Man muss in der betreffenden Warenposition das Mengenfeld in der Statistik ausfüllen, den Formularkopf wieder öffnen und diesen speichern. Es reicht nicht, nur die Position zu speichern... :roll:

Parallels VM Container with Ubuntu and Drupal not reacting

Februar 14th, 2013

Today one of my virtual machines didn't deliver content any more: Apache had port 80 open, but did not answer any request. Looking into Parallels, the privvmpages parameter was close to the hard limit and oomguarpages was way over the soft limit (no hard limit given). I couldn't login via SSH any more. SSH returned a key exchange error.
After a machine restart, all services on the VM worked again, but soon both mentioned parameters grew critical again. Spiders were crawling the site with many parallel connections.
Recently, the served website changed from Typo3 to Drupal. The settings of Apache were tuned for optimal performance of Typo3, but the requirements for the new Drupal are somewhat higher. In apache.conf, I decreased the number of allowed parallel connections and the Apache instances in general. The problem does not seem to occur any more. The performance did not suffer, even in the presence of crawlers.
I wonder, why the problem occured at all: Less than a quarter of the memory of the VM was used when I realized the problem in the beginning. Did the kernel try to optimize RAM usage by using paging too excessively...?

SPEICHERHUNGER unter Ubuntu Server 12.10

Februar 7th, 2013

Um dem Wahnsinn mit dem viel zu wenigen Speicherplatz wieder Herr zu werden, versuchte ich, ein Software-RAID 5 aufzubauen für vier Festplatten, von denen ich aber eine gerade noch nicht zur Hand hatte. mdadm findet das aber nicht so lustig und meint immer "You haven't given enough devices (real or missing) to create this array". Wenn man zu den vorhandenen Platten die Platte "missing" angibt, funktioniert das Anlegen allerdings trotzdem:
mdadm --create /dev/md0 --level=5 --raid-devices=4 /dev/sd{a,b,c}2 missing

PDO_DBLIB + MSSQL + Symfony 1.4 on Ubuntu

Dezember 30th, 2012

The setup is: An MSSQL within a virtual machine, a Symfony 1.4 installation on Ubuntu with PHP 5.3.5.
In order to get this working, php5-sybase needs to installed and the DSN needs to be set correctly. In the PHP manuals, it says something like "mssql:...", but this caused Symfony to throw the error "Couldn't locate driver named mssql". I used "dblib:..." instead and it works.

One problem occurred when using Admin Generator on an existing table: 500 | Internal Server Error | Doctrine_Connection_Exception OFFSET cannot be used in MSSQL without ORDER BY due to emulation reasons." This can be solved by doing this.

Another issue was "SQLSTATE[HY000]: General error: 207 General SQL Server error: Check messages from the SQL Server [207] (severity 16)". This only occurs for tables with many (>200) columns. I removed unnecessary columns from the schema.yml and the problem was gone. Interestingly, the query with all columns was correct and worked without a problem copy-pasting it to SQL Server Management Studio. Thus, the MSSQL adapter seems to have a problem with textually long queries.

One last issue was the date format MSSQL delivers: It causes the sfDateFormatter to throw "sfDateFormat.class.php on line 487 undefined offset", mentioning the year when trying to format a month. I decided for a workaround and left out datetimes here as well. But I would be interested, how MSSQL datetimes can be accessed...

EDIT: I needed some of the previously unnecessary columns later and found, that the amount of columns was not the problem. There was one column with a German umlaut causing the problem.