A Forgotten Tool to Quickly Remove All Related Files

By admin, May 31, 2014 10:58 pm

Today I found out there are over 100K PHP session files locate in Windows Temp directory and it’s impossible to open the Temp directory with Windows Explorer, hence not able to remove any file.

The solution is to use a dinosaur tool called DOS Command!

del /F /Q sess*

Da Da…after a few minutes, you can open the temp directory again with Windows Explorer, this really comes handy when you need it.

Of course, I’ve also changed the session.savepath and since PHP uses garbage collection every 24 minutes, so this left over session problem is fixed as well.

Why My PHP Script is Showing Raw Code? (Fixed)

By admin, May 31, 2014 11:47 am

Recently, I need to configure PHP to run on Windows Server 2008 R2. Even I’ve done this countless previously, but things still didn’t work in the first go, my test.php below displayed the raw code when running from browser.

<? phpinfo; ?>

It turns out to be a simple parameter (ie, short_open_tag) wasn’t turned on in php.ini.

;;;;;;;;;;;;;;;;;;;;
; Language Options ;
;;;;;;;;;;;;;;;;;;;;

; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It’s been
; recommended for several years that you not use the short tag “short cut” and
; instead to use the full <?php and ?> tag combination. With the wide spread use
; of XML and use of these tags by other languages, the server can become easily
; confused and end up parsing the wrong code in the wrong context. But because
; this short cut has been a feature for such a long time, it’s currently still
; supported for backwards compatibility, but we recommend you don’t use them.
; http://php.net/short-open-tag

short_open_tag = On