PHP 5.2.5 and php.ini

16 years 2 months ago #2906 by g3brown
My web host just upgraded to PHP 5.2.5 which broke sefadvance on my site. It appears to be a problem with the Ioncube loader. According to:

www.ioncube.com/faqs/loaders.php#5a0

I need a custom php.ini file with "zend_extension = /path/to/ioncube_loader_lin_5.2.so". I did this, which also requires that line to be at the top of the php.ini for some reason.

My question now is where does SEF Advance require the php.ini to be located. It doesn't appear that one in the base web directory is enough. Thanks.

Please Log in or Create an account to join the conversation.

16 years 2 months ago - 16 years 2 months ago #2907 by Saka
SEF Advance doesn't require php.ini

It's only matter of installing ionCube loaders correctly. If dynamic loading is possible all you need to do is to upload the loaders to your site. The SEF Advance tester will tell you whether the dynamic loading is possible.

If dynamic loading is not possible then the loader must be installed in php.ini and please take it up with your web host in that case.

If you can use a custom php.ini then, besides in your base directory and administrator directory, also put it in: components/com_sef/ and administrator/components/com_sef/

Emir Sakic
www.sakic.net

Please Log in or Create an account to join the conversation.

16 years 2 months ago - 16 years 2 months ago #2908 by g3brown
According to that page I linked ( www.ioncube.com/faqs/loaders.php#5a0 ) PHP 5.2.5 requires

zend_extension = /path/to/ioncube_loader_lin_5.2.so

in php.ini regardless; so I don't see a way around not having one. Note, before the upgrade to PHP 5.2.5 everything was fine with the dynamic loading without the the use of a modified php.ini file. After upgrade I couldn't get it to work without the use of php.ini. Same on 2 other sites as well. The next problem I had was this error message:

PHP Fatal error:  [ionCube Loader] The Loader must appear as the first entry in the php.ini file in Unknown on line 0

which I fixed by moving the new zend_extension line above the other zend references in the php.ini file. When making a new php.ini it is my understanding you have to have all options set and not just the ones you want to change. I attached a text file to this post that helps with that. Don't attempt any of this unless you know what your doing. :)

On 2 of my sites the next problem was the gallery2 module I use. It was generating this error:

PHP Fatal error:  Allowed memory size of 8388608 bytes exhausted (tried to allocate 77824 bytes) in /home/sitename/public_html/gallery2/modules/core/classes/GalleryTranslator.class on line 256

This appears to be cause by php allocating too much memory. I'm not sure if it was the write thing to do, but I just increased the size with

memory_limit = 12M

in the same php.ini. Just documenting this in case anyone else runs into a similar issue or has a better idea for me. I've had to use modded php.ini in the past and I don't really like it. It doesn't feel like a clean solution to the problem to me, but I don't see a way around it. Is there something I could ask my host to do that would enable me to keep things running without having to create a php.ini?

Please Log in or Create an account to join the conversation.

16 years 2 months ago - 16 years 2 months ago #2911 by Saka
Unfortunately, the PHP group decided to improve security by restricting features of dynamic loading method dl() in PHP 5.2.5+, so now the ionCube loaders can run dynamically only from the extension directory. This directory is most often out of the reach of share host users and is available only to the host administrator.

So on 5.2.5+ the ionCube loaders must be installed in php.ini unless the web host choose to put them in extension directory (our products already use the new preamble which will read them from there).
Luckily, on hosts that use CGI, you can use a custom php.ini with the path to your local ioncube loaders, like:
zend_extension = /path/to/ioncube_loader_lin_5.2.so

This php.ini file can only contain this line, doesn't have to have all lines, only the ones which you want to add/override. The file should be put in directories with encoded files which browser are calling directly. In SEF Advance case it means the root web directory (since the SEF Advance files are included, not called directly) and possibly administrator/components/com_sef/ directory since one file is called directly here by AJAX features (RSS newsfeed and latest version check).

More links on the matter:
forum.ioncube.com/viewtopic.php?t=1518
forum.ioncube.com/viewtopic.php?p=4643
forum.ioncube.com/viewtopic.php?p=4471

As fot the memory_limit = 12M, it is still too low, I would increase it to memory_limit = 64M at least in your local php.ini.

Emir Sakic
www.sakic.net

Please Log in or Create an account to join the conversation.

16 years 2 months ago #2915 by Saka
I put together a guide which should help getting ionCube to work: www.sakic.net/support/ioncube/

Emir Sakic
www.sakic.net

Please Log in or Create an account to join the conversation.

About us

We provide high quality Joomla components created by a co-founder and original core developer of Joomla. For over a decade, our products have been used by more than 20.000 webmasters around the world.

Stay in touch