{"id":473,"date":"2009-08-09T20:14:52","date_gmt":"2009-08-09T18:14:52","guid":{"rendered":"http:\/\/robert.kolatzek.org\/wblog\/?p=473"},"modified":"2009-08-09T20:14:52","modified_gmt":"2009-08-09T18:14:52","slug":"ein-schwerer-start-mit-doophp","status":"publish","type":"post","link":"https:\/\/blog.kolatzek.org\/wblog\/473\/ein-schwerer-start-mit-doophp","title":{"rendered":"Ein schwerer Start mit DooPHP"},"content":{"rendered":"<p>Es wird wohl den meisten von uns so gehen, wie mir&#8230; Man will sich ein neues geniales <a title=\"DooPHP - a very fast PHP-Framework\" href=\"http:\/\/doophp.com\/\">PHP-Framework<\/a> ansehen und wird unerwartet mit Fehlern konfrontiert (die es doch nicht geben d\u00fcrfte).<\/p>\n<p>Bevor Sie also am eigenen Verstand zweifeln, hier ein Hilfreicher Tipp zur Fehlermeldung:<\/p>\n<pre>Parse error: syntax error, unexpected T_STRING ...\/protected\/viewc\/***.php on line <strong>1<\/strong><\/pre>\n<p><!--more-->Wenn man in dooframework\/view\/DooView.php reinschaut und die render()-Methode so anschaut, f\u00e4llt auf, dass es mit $vfilename, $cfilename hantiert wird. Noch interessanter wird diese Stelle:<\/p>\n<pre>if(filemtime($cfilename)&gt;=filemtime($vfilename)){<\/pre>\n<p>Und wenn man sich diese Zeit Zeilen anschaut wir&#8217;s noch interessanter:<\/p>\n<pre>$cfilename = Doo::conf()-&gt;SITE_PATH . \"protected\/viewc\/$file.php\";\n$vfilename = Doo::conf()-&gt;SITE_PATH . \"protected\/view\/$file.html\";<\/pre>\n<p>Da gibt es einen Ordner f\u00fcr HTML-Templates (namens &#8222;view&#8220;) und einen mit PHP-Dateien (namens &#8222;viewc&#8220;). Doch wozu? Diese Zeile l\u00e4sst es schon vermuten:<\/p>\n<pre>$this-&gt;compile($file, $vfilename, $cfilename);<\/pre>\n<p>Die Templates werden f\u00fcr eine schnellere Ausf\u00fchrung kompilliert und als PHP-Dateien abgelegt. Da dort das PHP im XHTML\/<a class=\"zem_slink\" title=\"XML\" rel=\"wikipedia\" href=\"http:\/\/en.wikipedia.org\/wiki\/XML\">XML<\/a> verwendet wird, muss ja die Datei mit &#8218;<\/p>\n<pre>version=\"1.0\" encoding=\"utf-8\"<\/pre>\n<p>&#8230; und das kann nicht gut gehen. Die einzige M\u00f6glichkeit besteht darin die PHP-Konfigurationsvariable &#8222;<strong><code title=\"apache\">short_open_tag<\/code><\/strong>&#8220; zu deaktivieren. In der globalen php.ini w\u00fcrde ich das aber nicht machen. Wer wei\u00df wo ich vor Jahren &#8222;geschlampt&#8220; habe und das &#8222;&lt;? &#8220; verwendet&#8230; Doch &#8222;<strong>ini_set<\/strong>&#8220; in index.php der DooPHP-App zu setzen brint meist auch keinen Erfolg.<\/p>\n<p>DIE L\u00d6SUNG besteht darin, dies in <a class=\"zem_slink\" title=\".htaccess\" rel=\"wikipedia\" href=\"http:\/\/en.wikipedia.org\/wiki\/.htaccess\">.htaccess<\/a> im Ordner der index.php der Doo-PHP-App zu erledigen. Haben Sie diese Datei noch nicht? Dann sollten Sie es per &#8222;<strong>cp .htaccess.example .htaccess<\/strong>&#8220; kopieren, damit auch das Routing funktioniert. Wenn es auch dann nicht l\u00e4ut, schauen sie in der Apache-Konfiguration nach bzw. fragen Sie Ihren Provider nach &#8222;<strong>AllowOverride<\/strong>&#8222;-Option f\u00fcr Ihren Ordner. Es sollte in etwa so aussehen:<\/p>\n<pre>&lt;Directory ...\/dooPHP\/...\/&gt;\n AllowOverride All\n&lt;\/Directory&gt;<\/pre>\n<p>(mit dem &#8222;All&#8220; bin ich mir nicht sicher &#8211; &#8222;Options&#8220; d\u00fcrfte eigentlich auch reichen).<\/p>\n<pre>RewriteEngine On\n# if a directory or a file exists, use it directly\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\n# otherwise forward it to index.php\nRewriteRule .* index.php\nRewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]\n\n<span style=\"color: #ff0000\"><strong>php_flag short_open_tag 0<\/strong><\/span><\/pre>\n<p>in .htaccess l\u00f6st all unsere Probleme. Routing ist damit eingeschaltet und das PHP meldet keine Fehler mehr!<\/p>\n<p><strong>Jetzt den Apache neu starten und loslegen!<\/strong><\/p>\n<p><em>&#8230; Und nur so BTW: in protected\/.htaccess w\u00fcrde ich mal ein <\/em><\/p>\n<pre><em>Order Deny,Allow\nDeny from all<\/em><\/pre>\n<p><em>empfehlen. Es muss ja nicht jeder alles sehen oder? Vor allem dann, wenn protected nicht unterhalb des Document_Root abgelegt werden kann.<\/em><\/p>\n<div class=\"zemanta-pixie\" style=\"margin-top: 10px;height: 15px\"><a class=\"zemanta-pixie-a\" title=\"Reblog this post [with Zemanta]\" href=\"http:\/\/reblog.zemanta.com\/zemified\/96beffd3-8b9d-46c1-b40f-d28b78d6bf44\/\"><img decoding=\"async\" class=\"zemanta-pixie-img\" style=\"border: medium none;float: right\" src=\"http:\/\/img.zemanta.com\/reblog_e.png?x-id=96beffd3-8b9d-46c1-b40f-d28b78d6bf44\" alt=\"Reblog this post [with Zemanta]\" \/><\/a><span class=\"zem-script more-related pretty-attribution\"><\/span><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Es wird wohl den meisten von uns so gehen, wie mir&#8230; Man will sich ein neues geniales PHP-Framework ansehen und wird unerwartet mit Fehlern konfrontiert (die es doch nicht geben d\u00fcrfte). Bevor Sie also am eigenen Verstand zweifeln, hier ein Hilfreicher Tipp zur Fehlermeldung: Parse error: syntax error, unexpected T_STRING &#8230;\/protected\/viewc\/***.php on line 1<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":""},"categories":[8],"tags":[11,25,32,82,96,98],"class_list":["post-473","post","type-post","status-publish","format-standard","hentry","category-software","tag-apache","tag-config","tag-doophp","tag-php","tag-server","tag-sicherheit","entry"],"_links":{"self":[{"href":"https:\/\/blog.kolatzek.org\/wblog\/wp-json\/wp\/v2\/posts\/473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.kolatzek.org\/wblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kolatzek.org\/wblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kolatzek.org\/wblog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kolatzek.org\/wblog\/wp-json\/wp\/v2\/comments?post=473"}],"version-history":[{"count":0,"href":"https:\/\/blog.kolatzek.org\/wblog\/wp-json\/wp\/v2\/posts\/473\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.kolatzek.org\/wblog\/wp-json\/wp\/v2\/media?parent=473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kolatzek.org\/wblog\/wp-json\/wp\/v2\/categories?post=473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kolatzek.org\/wblog\/wp-json\/wp\/v2\/tags?post=473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}