Posts tagged with: php

2012-09-30

PHP is not easy as it may seem

PHP is often regarded to as an easy web programming language/environment with a fast learning curve. Perhaps, this is mainly due to the following reasons. Read more...

Tags: php
2012-12-15

PHP's nl2br equivalent in JSPs

Some of PHP’s built-in functions can be quite handy. One of these is nl2br, which transforms newlines (\n and other variants) into HTML line breaks (<br>) — more precisely, it puts a <br> before each newline.
It has been used, and sometimes is still used, when echoing a CLOB on a webpage.

Actually, this function is no longer necessary: with the CSS property white-space you can do the same on the client-side in a neat and efficient way. However, this post is just an example on how to create something resembling PHP’s built-in functions using the instruments of Java EE. Read more...

Tags: java, php
2013-05-24

How to shutdown a linux system from within a PHP script

If you run a linux system with the Apache web server and PHP, you may want to shutdown the system from within a PHP script.

The obvious idea is to call system("shutdown -h now") from PHP, but it will not work if Apache is run by an unprivileged user (actually, it should).

Here is my solution, merging various sources from the Internet. I find it the cleanest one. Read more...

Tags: linux, php
Fork me on GitHub