Monday 7 March 2011

Knowledge Tree and PHP 5.3.3

We have got the latest PHP version on Hostsharing, and Knowledge Tree 3.7.0.2 did not work anymore.
I got a long list of deprecated warnings, and the session would not even start, so not even a login screen is displayed.

Deprecated: Assigning the return value of new by reference is deprecated
Warning: The magic method __get() must have public visibility and cannot be static
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent

The solution is to edit config/dmsDefaults.php, find the lines containing
error_reporting(E_ALL & ~E_NOTICE);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
Below that, add the following line:
error_reporting(0);
Now Knowledge Tree 3.7.0.2 will work again, and hopefully the next version of Knowledge Tree will have fixed all the deprecated PHP things.

9 comments:

Unknown said...

Thank you. Made my night a couple of hours longer.

How did you find out?

Saludos

Mario

BTW: If the wizard doesn't let you install KT on php 5.3 just change a line in /setup/wizard/steps/dependencies.php

change phpversion to 5.4 or something. :)

syamsul said...

Hi I have followed your tip on my PHP 5.3.10 server but now on

myknowledgetreesite/control.php

I get a blank screen :(

Can you advise? Thanks!

Timotheus Pokorra said...

a blank screen is usually a sign for a typo. Check your changes again. Otherwise modify your php.ini to show errors (display_errors = On), which might help you to find the line of your typo.

syamsul said...

Hi I have double checked the edit. When I remove the line

error_reporting(0);


I will get output on the page like this:

Deprecated: Assigning the return value of new by reference is deprecated in etc etc etc

I definitely don't have a typo - when I put it back in, the whole screen shows a blank :(

I did a

tail -f /var/log/messages

and reloaded the page (and get a blank)
but it does not show any errors

Timotheus Pokorra said...

You can also try to use error_reporting(E_ERROR);
see also http://php.net/manual/en/function.error-reporting.php for possible parameters.

On the other hand, I am quite disappointed with KnowledgeTree, since it seems they are not developing the community version anymore. See also this thread: http://forums.knowledgetree.org/viewtopic.php?f=3&t=20951

I am personally considering to try Alfresco, but I have not found an easy way yet to migrate my documents with versioning to Alfresco.

daserzw said...

On my server, Apache/2.2.9 PHP 5.3.3-7 Debian, I needed to fix the error_reporting in /etc/php5/apache2/php.ini too.
By the way, it is not needed to set the error_reporting to 0, "E_ALL & ~E_WARNING & ~E_NOTICE & ~E_DEPRECATEDE_ALL & ~E_WARNING & ~E_NOTICE & ~E_DEPRECATED" (in both dmsDefaults.php __and__ php.ini) will do the trick.

davide

Unknown said...
This comment has been removed by a blog administrator.
Unknown said...

Has anyone got KT 3.7 working on PHP 5.3 on a host?

I was trying to install a fresh KT 3.7 Community to Dreamhost (php5.3) (Their 5.2 doesn't support XMLRPC)

I did your mods and ran into misconfigured MySQL (config/config.ini), depreciated code, then more DB errors. After the more DB errors, I gave up.

Marsint IT said...

I redownloaded KT 3.7 community from Freecode.

After manually grepping and tricking the installer, I was able to get a "install finished" dialog.

After removing the & from line 419 in login.php, now all I get is a blank screen.

It seems that line 420 is crashing the whole thing. I couldn't find where or what "dispatch()" does so I couldn't probe that code.

Any other suggestions?