View previous topic :: View next topic |
Author |
Message |
bb Smarty n00b
Joined: 01 Oct 2020 Posts: 3
|
Posted: Thu Oct 01, 2020 6:47 pm Post subject: Blank white page - Smarty object exists and is populated |
|
|
Hello forum,
I`ve been fighting with this for days now - I have my own framework for CMS and use Smarty as my template engine. Suddenly, the page output was only white and I can't make it work again. Setting the debug option doesn't open up the usual popup window either.
Using the php debug output there are no errors on the page (just a few warnings), but when I var_dump the Smarty object as the very last line in the code the output is just populated correctly with the values coming from the database.
Creating a test page with just one variable does not work either.
I just don't know where to look any more....
php version: 7.4.10
Smarty Version: 2.6.27 (I know, I know - quite old. Haven't had the time to upgrade to v3 yet)
apache version: 2.4.46 (FreeBSD) OpenSSL/1.0.2u-freebsd
Thanks a lot in advance! |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Oct 02, 2020 8:17 am Post subject: |
|
|
Check the server logs. Most likely you have error in your PHP code.
|
|
Back to top |
|
bb Smarty n00b
Joined: 01 Oct 2020 Posts: 3
|
Posted: Mon Oct 05, 2020 3:13 pm Post subject: |
|
|
Thanks for that link. The importance of putting the display_error and error_reporting into the php.ini is new to me, but very useful.
Unfortunetly, even with those 2 values in the php.ini I don't get any new error messages. Also, I don't think it's a php error, as my very last line in the php file is executed where I do a
Code: | var_export($smarty) |
And in that export I see the content I want to display.
Another thing I noticed is that in the templates_c directory the corresponding file to my template contains nothing but the compile information. Is this maybe a hint? The directory rights are 775, so the webserver can write there.
Thanks! |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Oct 06, 2020 9:53 am Post subject: |
|
|
If compiled template contains no actual PHP code, that may be a problem in your template or the way you are referencing it. |
|
Back to top |
|
bb Smarty n00b
Joined: 01 Oct 2020 Posts: 3
|
Posted: Tue Oct 06, 2020 9:14 pm Post subject: |
|
|
ok, I've found out something....this is the setup:
one domain running php 5
another domain running php 7
same php+tpl works under php 5, but not under php7. The only warning I get under php 7 is this:
Code: | preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in [..]/Smarty_Compiler.class.php on line 270
|
but I think this is not the reason, as I've already had the script running under php 7. Is there any apache directive that could prevent Smarty from working? |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Tue Oct 06, 2020 11:49 pm Post subject: |
|
|
I cannot assume this would work with Smarty 2, but if Smarty is throwing an exception, then in your PHP code, try to create an exception handler - if your CMS does not have one already. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Oct 07, 2020 3:36 am Post subject: |
|
|
bb wrote: | The only warning I get under php 7 is this:
Code: | preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in [..]/Smarty_Compiler.class.php on line 270
|
|
This is not a warning, this is a compilation error. PHP compilation error, not Smarty. Go upgrade your libs.
Quote: | but I think this is not the reason, as I've already had the script running under php 7. Is there any apache directive that could prevent Smarty from working? |
The error message is quite clear, don't you think? You are using version of Smarty that is not compatible with PHP7. |
|
Back to top |
|
|