Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
andreamarucci
Experienced
Topic Author
Posts: 308
Joined: 01 Mar 2011, 11:13

PHP Fatal error

12 Oct 2016, 06:14

Hello Karl, just updated to 0.20 but this error was there also before. Each time someone access the gallery, I get this error in the error log.

It's something that I can deal with in any way or there are no problems apart the error log growing?

Thanks!
Code
[12-Oct-2016 12:11:24 Europe/Berlin] PHP Fatal error:  Uncaught Exception: './templates/page.ico' template not found. in /home/kogit/gallery/app/parsers/template-parser.inc.php:7
Stack trace:
#0 /home/kogit/gallery/app/parsers/template-parser.inc.php(14): TemplateParser::find_template('./templates/pag...')
#1 /home/kogit/gallery/app/asset-types/page.inc.php(46): TemplateParser::parse(Array, './templates/pag...')
#2 /home/kogit/gallery/app/cache.inc.php(98): Page->parse_template()
#3 /home/kogit/gallery/app/stacey.inc.php(102): Cache->create('custom/404', './content/custo...', true)
#4 /home/kogit/gallery/app/stacey.inc.php(214): Stacey->render('./content/custo...', './templates/pag...')
#5 /home/kogit/gallery/app/stacey.inc.php(367): Stacey->create_page('./content/custo...')
#6 /home/kogit/gallery/app/stacey.inc.php(342): Stacey->not_found()
#7 /home/kogit/gallery/index.php(33): Stacey->__construct(Array)
#8 {main}
  thrown in /home/kogit/gallery/app/parsers/template-parser.inc.php on line 7
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13998
Joined: 30 Sep 2006, 03:37

Re: PHP Fatal error

12 Oct 2016, 11:12

I am really not sure what kinda request creates this error, but it has nothing to do with your core X3 website pages, thats for sure. 100% sure you can ignore it.

It looks like some kinda strange request to an *.ico file on your server, but this is not part of X3. If you want to debug it further, try this: 1) Empty your error log. 2) Visit your page, and browser around. Is the error immediately re-created in the log? I would like to know if it occurs from X3 page requests, which I doubt. This request could only be possible if there is something/someone/somewhere that requests some "URL/path/pagename.ico" ... but X3 doesn't deal with "*.ico" files at all (there is nothing in the source).

Further thinking ... This seems to happen when request is made to a file that doesn't exist. Looks like this should perhaps be handled by the .htaccess file, instead of going through the X3 application, which looks for a template and creates an error. I will look further into it ... But essentially, I am pretty sure that the error is created from requests to files that don't exist (bots might try this for example).
 
User avatar
andreamarucci
Experienced
Topic Author
Posts: 308
Joined: 01 Mar 2011, 11:13

Re: PHP Fatal error

12 Oct 2016, 11:19

That's exactly what I've done before writing you. Deleted the log, tried to access the gallery (note that in the domain gallery.kog.it there's only Imagevuex) and immediately the error appeared. Checked now and it's the same, there are some other errors but all identical to that one.
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13998
Joined: 30 Sep 2006, 03:37

Re: PHP Fatal error

12 Oct 2016, 12:17

Its definitely a request to a file that doesn't exist, that is not part of X3 pages ...

Just for test, I am making a request "gallery.kog.it/20062010/2006.alibaba" ... Do you get an error log "... Uncaught Exception: './templates/page.alibaba' template not found ..."?
 
User avatar
andreamarucci
Experienced
Topic Author
Posts: 308
Joined: 01 Mar 2011, 11:13

Re: PHP Fatal error

12 Oct 2016, 12:20

Here it is
Code
[12-Oct-2016 18:15:37 Europe/Berlin] PHP Fatal error:  Uncaught Exception: './templates/page.alibaba' template not found. in /home/kogit/gallery/app/parsers/template-parser.inc.php:7
Stack trace:
#0 /home/kogit/gallery/app/parsers/template-parser.inc.php(14): TemplateParser::find_template('./templates/pag...')
#1 /home/kogit/gallery/app/asset-types/page.inc.php(46): TemplateParser::parse(Array, './templates/pag...')
#2 /home/kogit/gallery/app/cache.inc.php(98): Page->parse_template()
#3 /home/kogit/gallery/app/stacey.inc.php(102): Cache->create('custom/404', './content/custo...', true)
#4 /home/kogit/gallery/app/stacey.inc.php(214): Stacey->render('./content/custo...', './templates/pag...')
#5 /home/kogit/gallery/app/stacey.inc.php(367): Stacey->create_page('./content/custo...')
#6 /home/kogit/gallery/app/stacey.inc.php(342): Stacey->not_found()
#7 /home/kogit/gallery/index.php(33): Stacey->__construct(Array)
#8 {main}
  thrown in /home/kogit/gallery/app/parsers/template-parser.inc.php on line 7
 
User avatar
andreamarucci
Experienced
Topic Author
Posts: 308
Joined: 01 Mar 2011, 11:13

Re: PHP Fatal error

12 Oct 2016, 12:20

And another one, don't know if yours
Code
[12-Oct-2016 17:14:40 Europe/Berlin] PHP Fatal error:  Uncaught Exception: './templates/page.gah' template not found. in /home/kogit/gallery/app/parsers/template-parser.inc.php:7
Stack trace:
#0 /home/kogit/gallery/app/parsers/template-parser.inc.php(14): TemplateParser::find_template('./templates/pag...')
#1 /home/kogit/gallery/app/asset-types/page.inc.php(46): TemplateParser::parse(Array, './templates/pag...')
#2 /home/kogit/gallery/app/cache.inc.php(98): Page->parse_template()
#3 /home/kogit/gallery/app/stacey.inc.php(102): Cache->create('custom/404', './content/custo...', true)
#4 /home/kogit/gallery/app/stacey.inc.php(214): Stacey->render('./content/custo...', './templates/pag...')
#5 /home/kogit/gallery/app/stacey.inc.php(367): Stacey->create_page('./content/custo...')
#6 /home/kogit/gallery/app/stacey.inc.php(342): Stacey->not_found()
#7 /home/kogit/gallery/index.php(33): Stacey->__construct(Array)
#8 {main}
  thrown in /home/kogit/gallery/app/parsers/template-parser.inc.php on line 7
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13998
Joined: 30 Sep 2006, 03:37

Re: PHP Fatal error

12 Oct 2016, 13:30

Yep, both are mine ...

With this, we can conclude the following: The error comes from invalid requests. Somewhere in your website setup, you have a request to /some/path/*.ico, hence the error you are seeing for "'./templates/page.ico' template not found". From that, I can further conclude the following:
  • This is NOT from X3 ... X3 does not try to load any "ico" files. You can check the source and templates to confirm that.
  • It's almost certainly the browser trying to request an "favicon.ico" file for your website, which doesn't exist ... No reason it should, as we define favicon as a meta tag in the source code. However, it seems some browsers will still try to check if a "favicon.ico" file exists anyway ... I found a related discussion here.
  • In ANY regards, the issue is entirely harmless. It occurs on requests that do not- and should not exist, and aren't supposed to display anything.
  • However, I will need to look into this. Requests to files that don't exist should not be handled by the X3 application, but instead just route to a "404 file not found", via the .htaccess ... 
So, nothing to worry about, but I will be looking into this for next release. Thanks for feedback ...
 
User avatar
andreamarucci
Experienced
Topic Author
Posts: 308
Joined: 01 Mar 2011, 11:13

Re: PHP Fatal error

12 Oct 2016, 15:21

Htaccess. Could it be this one the problem? Can I use the stock Htaccess or do I have to edit something?
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13998
Joined: 30 Sep 2006, 03:37

Re: PHP Fatal error

12 Oct 2016, 23:47

andreamarucci wrote:Htaccess. Could it be this one the problem? Can I use the stock Htaccess or do I have to edit something?
The main PROBLEM is that you/someone/browser is trying to access url's that don't exist. To solve the *.ICO issue, just place a file "favicon.icon" in your domain root. Browser will then load this file.

As for improving X3 so that these files don't get requested through the X3 PHP application, I need to look into this ... It works fine already for most servers, including my localhost, and for example this website "geopalstudio.com/x3/galleries.ico" (also using latest X3).
Image

I am not sure why it reacts differently on your server and in our demo gallery. I need to look into the .htaccess, but also fix some PHP files so that template files that don't exist are not requested, and will not incur errors in the log. As mentioned though, it is entirely harmless, and the request itself still outputs a "404 file not found".
Image 
The request itself is an error no matter what, because the file/request does not exist. I would like to try to fix it so that X3 doesn't try to request an invalid template file though ... in which case, this error will not be written to log. It's likely more server-effective to avoid having the server handle requests to files that don't exist ... However, X3 will need to route requests to the X3 application in most regards anyway, because it needs to check if the requested URL path corresponds to an actual folder-path.

For now, I don't have a solution. The request itself is invalid, and will always be an error. On your server, it gets routed through X3 and outputs an error to the log. I will look into it for next release, but I don't have an immediate solution.
 
User avatar
andreamarucci
Experienced
Topic Author
Posts: 308
Joined: 01 Mar 2011, 11:13

Re: PHP Fatal error

13 Oct 2016, 02:58

No problems Karl, just trying to help you. I can delete the error.log without problems :-)
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13998
Joined: 30 Sep 2006, 03:37

Re: PHP Fatal error

15 Nov 2016, 10:19

This issue is fixed in X3 Release [0.21]
https://forum.photo.gallery/viewtopic.php?f=51&t=9157