Fix WordPress Update

Written by  on März 22, 2017

Wenn WordPress nicht mehr nach /tmp schreiben darf kommt vom Autoupdate eine Fehlermeldung nach diesem Muster


Die Lösung ist einfach, es muss ein Temp-Verzeichnis definiert werden, auf das WordPress selber noch Zugriff hat.

define('WP_TEMP_DIR', ABSPATH . 'wp-content/tmp');


WordPress und PHP7

Written by  on Januar 18, 2017

Ein neues PHP ist verfügbar für den Webspace! Sofort aktivieren, für WordPress ist das kein Problem!
Doch was passiert – alle Beiträge sind leer.
Was steht im Log?

Got error 'PHP message: PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead

Die Lösung habe ich unter gepostet. Dieses nette wp-code-highlight Plugin zerreisst es leider komplett, wenn ich diese Zeilen einfüge.

Gute Infos gibt es auf stackoverflow

PHP random string generator at bing

Written by  on November 24, 2016

Ich war etwas verwundert, was man mit dem Suchbegriff auf Bing so vorgeschlagen bekommt.
PHP random string bing

Download a Variable with PHP

Written by  on April 12, 2016

You have a variable in php which should get into a file for download. But you don’t want to put it actually into a file? Then call the following script which does exactly that for you:

header("Content-type: text/plain");
header("Content-Disposition: attachment; filename=$filename");

What’s obfuscation and what is it good for?

Written by  on Dezember 3, 2015

To see how PHP code obfuscation works, you might check out the Free Online PHP Obfuscator. What happens there, makes your code completeley unreadable. But, it creates an enormous base64 encoded file, which simply might be too much. Also I had some troubles with *larger* php scripts with around 50 lines.
Nevertheless, you’ll be able to copy a neat trick from there. First a function name gets decoded in hex. If you have no idea about how to do it check out string to hex. So now you are able to encode your function name into a variable


Now we are able to replace the calls to the system function with our variable from

system("openssl req -noout -modulus -in testfile.csr >/dev/null 2>&1",$ret);


$a("openssl req -noout -modulus -in testfile.csr >/dev/null 2>&1",$ret);

So what is it good for? Could you hide from the disabled function in the php.ini? That’s a clear no! But this helps, when there is some nasty „maleware scanner“ that would delete your scripts from your webspace because of containing a call of the system function.
Is it secure? As always it depends. If you use PHP to execute some hardcoded shell script, this might work in a secure way. If you hand input to your scripts, you should be extra sure, that you know what you are doing!
Will it scale? I guess no. There is no protection from PHP in a way that you might DDOS yourself i.e. your webspace.
Also check for race conditions. Just think about what will happen, when you write into a file – and another call to the webserver will write into the same file.

PHP Mailer Test

Written by  on April 18, 2015

Notiz an mich – teste die PHP Mail Funktion

ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = "emailtest@YOURDOMAIN";
$subject = "PHP Mail Test script";
$message = "This is a test to check the PHP Mail functionality";
$headers = "From:" . $from;
mail($to,$subject,$message, $headers);
echo "Test email sent";

Quelle: Simple PHP Mail test

Greift das PHP Memory Limit?

Written by  on November 1, 2011

Manchmal ticken PHP Prozesse einfach aus und belegen "unendlich viel" Speicher. Überlegt man sich Maßnahmen zur Limitierung des Speicherbedarfes, muss man sich auch darum kümmern, ob diese eingehalten werden und nicht wieder von einem PHP Script mit ini_set übergangen werden:


ini_set("memory_limit", "3G");

$array = array();

while (true) {
    $array[] = str_repeat("nureinstring", 10000);