Loading...
 
Skip to main content

Architecture / Installation


[Solved] Blank Page Problem - Bug of php 5.2.4 & 5.2.5 on Windows

Hi,

I've just install Tiki 3.0 on server and the blank page shows after installation.

Yes I've read these topics:
- Tiki Install Requirements! Please read!Question
- PHP Memory Limit RequirementsQuestion

I did try modifying php.ini
- memory_limit 64M
- max_execution_time 600
Still the blank page hits me 😢

So I tried install in another computer (my pc).
Good news, it completely works.

Unfortunately, I have to make it run on the server.
I appended small code to tiki-index.php to query data directly from database.
It shows only result from my code. Where is the contents of tiki?

My server environments:
- PHP 5.2.5
- Apache 2.2.8
- MySQL 5.0.51a

I'd appreciate if anyone can advise me what should I check or try.

I debug until found the root cause. It's because of bug in php's realpath() function which is used in:
TikiWiki version 3.0
File: \lib\smarty\libs\internals\core.is_secure.php
Line# 28

The realpath() returns \ character at the end while it should not.
See bug details in Bug #43248 backward compatibility break in realpath()Question

Note that this happens with php 5.2.4 & 5.2.5 on Windows.


Solution:
Since I cannot upgrade php in the server. So I modify php code by replaced line #28-32:

Copy to clipboard
if ( ($_cd = realpath($curr_dir)) !== false && strncmp($_rp, $_cd, strlen($_cd)) == 0 && substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) { return true; }

replaced with:

Copy to clipboard
if ( phpversion() == "5.2.4" || phpversion() == "5.2.5" ) { //Use substr() to remove last character from realpath() if ( ($_cd = substr(realpath($curr_dir), 0, (strlen(realpath($curr_dir))-1))) !== false && strncmp($_rp, $_cd, strlen($_cd)) == 0 && substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) { return true; } } else { //Use original code if ( ($_cd = realpath($curr_dir)) !== false && strncmp($_rp, $_cd, strlen($_cd)) == 0 && substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) { return true; } }

I'm new to php. So if there's any better solution please advise.


Did it help? Cause I still have no effect...

The php versions that cause this problem is actually 5.2.4 & 5.2.5. (Not 4.2.4 nor 4.2.5)
Very sorry for my mistake.

To heavenmaster: It completely solved my case.

Please be reminded that if you use newer version of php, such as 5.2.9 which I did try in my pc, then no need to change any tiki code since this bux is now fixed in php.


Attached file is my modified php file to solve this problem.
Put in lib\smarty\libs\internals\core.is_secure.php

Thanks a lot! Your solution really works )
I do not understand why it could not changed it by myself when you first time posted your instructions.




I think this may be the problem I'm experiencing. Did you get a blank page (ie it gets something but it's empty) or a no-response page like I get? It looks like this:

Copy to clipboard
Internet Explorer cannot display the webpage Most likely causes:
etc


I am using PHP 5.2.5 but noticed that my phpversion() returns "5.2.5 (x64)" so suggest the following fix to your code:

Copy to clipboard
if ( strtok(phpversion()," ") == "5.2.4" || strtok(phpversion()," ") == "5.2.5" ) {


However even with this, I still don't get anything back! I need to start looking in other directions, I suppose. It's quite frustrating to have gone through a "successful" installation and then find that it simply doesn't respond.