You are here: Re: [PHP] Virtual includes of PHP into SSI pages. « PHP « IT news, forums, messages
Re: [PHP] Virtual includes of PHP into SSI pages.

Posted by cron on 11/14/05 18:09

For this to work you must set html and shml as a php file extension in
apache.

This is because shml includes are made before it reaches apache output, so
if you have file "a" including file "b" it the same as having only one file
"a" with copy and paste of file "b" with shml file extension and thus this
is never parsed to php.

Hope i´m making any sense here, bad english

Angelo



----- Original Message -----
From: "Neil Hoggarth" <neil.hoggarth@physiol.ox.ac.uk>
To: <php-general@lists.php.net>
Sent: Monday, November 14, 2005 11:01 AM
Subject: [PHP] Virtual includes of PHP into SSI pages.


> Hi Folks,
>
> I'm attempting to diagnose an apparent problem with my Apache/PHP
> server setup. The platform is SPARC Solaris 9. I'm running Apache httpd
> 2.0.55 and PHP 4.4.1, built from NetBSD pkgsrc.
>
> I have a user who has .shtml (server side include) pages which include
> PHP fragments using directives like <!--#include virtual="/name.php" -->
> (and yes, I know this is silly, and that obvious thing to do is to use
> PHP for the top level pages rather than SSI; unfortunatly I'm the
> sysadmin providing the service, rather than the person maintaining the
> content).
>
> I wanted to check to see if anyone knows of any known problems or
> gotchas in this area?
>
> I'm told that this mechanism was working okay until recently, but it
> broke at some point in the last few months. I've done a number of
> upgrades to both the apache2 and PHP packages over the time period in
> question, in response to security advisories; unfortunately the user
> can't pinpoint exactly when things started to fail.
>
> I've recreated a very simple test case:
>
> test.shtml:
>
> <html>
> <head>
> <title>Test Page</title>
> </head>
> <body>
> <p>Begin Test</p>
> <!--#include virtual="/foo1.php" -->
> <p>End Test</p>
> </body>
> </html>
>
> foo1.php:
>
> <p>Hello From PHP</p>
>
> Fetching "test.shtml" produces the output:
>
> Begin Test
>
> End Test
>
> (no sign of the included fragment in the output).
>
> Editing the test harness to teplacing the include of foo1.php with an
> include of a plain HTML or SHTML file produces the expected output
> (included content appears in the output between the begin and end
> markers).
>
> Furthermore, if I edit the test harness to include an HTML file and
> *then* the PHP fragment, I get a reproduceable segmentation fault in
> PHP:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0xfecb541c in zend_hash_index_update_or_next_insert (ht=0xfed3c1c4, h=0,
> pData=0xffbfdec8, nDataSize=12,
> pDest=0x0, flag=1) at
> /export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/Zend/zend_hash.c:390
> 390 p = ht->arBuckets[nIndex];
> (gdb) where
> #0 0xfecb541c in zend_hash_index_update_or_next_insert (ht=0xfed3c1c4,
> h=0, pData=0xffbfdec8,
> nDataSize=12, pDest=0x0, flag=1)
> at
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/Zend/zend_hash.c:390
> #1 0xfecb8cc0 in zend_list_insert (ptr=0x299250, type=2)
> at
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/Zend/zend_list.c:45
> #2 0xfecb8eb8 in zend_register_resource (rsrc_result=0x0,
rsrc_pointer=0x299250, rsrc_type=2)
> at
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/Zend/zend_list.c:98
> #3 0xfec693d8 in _php_stream_alloc (ops=0xfed31528, abstract=0x1eb770,
persistent_id=0x0,
> mode=0xfece83f0 "rb") at
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/streams.c:281
> #4 0xfec6e0b0 in _php_stream_fopen_from_fd (fd=22, mode=0xfece83f0 "rb",
persistent_id=0x0)
> at
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/streams.c:2072
> #5 0xfec6de5c in _php_stream_fopen (filename=0x297cb8
"/usr/pkg/share/httpd/htdocs/foo1.php",
> mode=0xfece83f0 "rb", opened_path=0xffbfeb90, options=165)
> at
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/streams.c:2004
> #6 0xfec6d5cc in _php_stream_fopen_with_path (filename=0x297cb8
"/usr/pkg/share/httpd/htdocs/foo1.php",
> mode=0xfece83f0 "rb", path=0xfece7fc8 ".:/usr/pkg/lib/php",
opened_path=0xffbfeb90, options=165)
> at
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/streams.c:1784
> #7 0xfec6efd4 in php_plain_files_stream_opener (wrapper=0xfed31598,
> path=0x297cb8 "/usr/pkg/share/httpd/htdocs/foo1.php", mode=0xfece83f0
"rb", options=165,
> opened_path=0xffbfeb90, context=0x0)
> at
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/streams.c:2489
> #8 0xfec6fb18 in _php_stream_open_wrapper_ex (path=0x297cb8
"/usr/pkg/share/httpd/htdocs/foo1.php",
> mode=0xfece83f0 "rb", options=173, opened_path=0xffbfeb90,
context=0x0)
> at
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/streams.c:2696
> #9 0xfec6ff34 in _php_stream_open_wrapper_as_file_handle (
> path=0x297cb8 "/usr/pkg/share/httpd/htdocs/foo1.php", mode=0xfece83f0
"rb", options=141, fh=0xffbfeb88)
> at
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/streams.c:2823
> #10 0xfec53900 in php_open_wrapper_for_zend (filename=0x297cb8
"/usr/pkg/share/httpd/htdocs/foo1.php",
> fh=0xffbfeb88) at
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/main.c:764
> #11 0xfec82730 in open_file_for_scanning (file_handle=0xffbfeb88) at
Zend/zend_language_scanner.c:3022
> #12 0xfec82a34 in compile_file (file_handle=0xffbfeb88, type=2) at
Zend/zend_language_scanner.c:3114
> #13 0xfecae520 in zend_execute_scripts (type=2, retval=0x0, file_count=1)
> at /export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/Zend/zend.c:934
> #14 0xfecd2b74 in php_handler (r=0x297150)
> at
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/sapi/apache2handler/sapi_ap
ache2.c:574
> #15 0x000e3c28 in ap_run_handler (r=0x297150) at config.c:152
> #16 0x000e4848 in ap_invoke_handler (r=0x297150) at config.c:364
> #17 0x00114840 in ap_run_sub_req (r=0x297150) at request.c:1855
> #18 0x000382a4 in handle_include (ctx=0x283660, bb=0xffbfef78, r=0x289118,
f=0x28a9c0, head_ptr=0x2876e8,
> inserted_head=0xffbfeee8) at mod_include.c:782
> #19 0x0003fa58 in send_parsed_content (f=0x28a9c0, bb=0x28abb0) at
mod_include.c:3309
> #20 0x0004093c in includes_filter (f=0x28a9c0, b=0x28abb0) at
mod_include.c:3591
> #21 0x000fe614 in ap_pass_brigade (next=0x28a9c0, bb=0x28abb0) at
util_filter.c:512
> #22 0x0010cde0 in default_handler (r=0x289118) at core.c:3640
> #23 0x000e3c28 in ap_run_handler (r=0x289118) at config.c:152
> #24 0x000e4848 in ap_invoke_handler (r=0x289118) at config.c:364
> #25 0x00094aac in ap_process_request (r=0x289118) at http_request.c:249
> #26 0x0008bac0 in ap_process_http_connection (c=0x2831d8) at
http_core.c:251
> #27 0x000f9820 in ap_run_process_connection (c=0x2831d8) at
connection.c:43
> #28 0x000f9e04 in ap_process_connection (c=0x2831d8, csd=0x283100) at
connection.c:176
> #29 0x000e1574 in child_main (child_num_arg=0) at prefork.c:610
> #30 0x000e16c0 in make_child (s=0x1b80b0, slot=0) at prefork.c:650
> #31 0x000e1878 in startup_children (number_to_start=5) at prefork.c:722
> #32 0x000e1f8c in ap_mpm_run (_pconf=0x16cda8, plog=0x1b2ec0, s=0x1b80b0)
at prefork.c:941
> #33 0x000eced8 in main (argc=2, argv=0xffbff77c) at main.c:618
>
>
> Regards,
> --
> Neil Hoggarth Departmental Computing
Manager
> <neil.hoggarth@physiol.ox.ac.uk> Laboratory of
Physiology
> http://www.physiol.ox.ac.uk/~njh/ University of Oxford,
UK
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация