Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 11:45 am EST

Geeklog Forums

can't create staticpage with php code sample


kyngchaos

Anonymous
I'm trying to put a PHP code sample on a staticpage and it seems like geeklog is trying to execute it right away or something - I get a server error that "The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.".

The same example works posting in a story (html mode, old-fashioned non-wysiwyg editor). Am I missing some trick? Bug in staticpages?

This is how I'm trying to add it to the staticpage (hopefully it will work in the forum):

Text Formatted Code
<p><code>&lt;?php<br>
dl(&quot;php_mapscript.so&quot; );<br>
phpinfo();<br>
?&gt;</code></p>

 
 Quote

kyngchaos

Anonymous
Oh, yeah - Geeklog 1.4.0sr2
 Quote

kyngchaos

Anonymous
sorry to keep responding to myself. I have the option to NOT execute PHP selected.

And that's on my webhost's server (Dreamhost). PHP 4.4.2 CGI, MySQL 4.1.14

I just tried on another server where I work (also GL 1.4.0sr2) and it works. PHP 4.4.0 CGI, MySQL 4.1.9.

I think this is the right error from the httpd error log:

Text Formatted Code
[error] mod_security: Access denied with code 503. Pattern match "(chr|fwrite|fopen|system|echr|passthru|popen|proc_open|shell_exec|exec|proc_nice|proc_terminate|proc_get_status|proc_close|pfsockopen|leak|apache_child_terminate|posix_kill|posix_mkfifo|posix_setpgid|posix_setsid|posix_setuid|phpinfo)(.*);" at POST_PAYLOAD. [hostname "www.kyngchaos.com"] [uri "/admin/plugins/staticpages/index.php"]
 
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Your hosting service is blocking certain PHP functions (see the list you quoted - phpinfo is in there). Not Geeklog's problem ...

bye, Dirk
 Quote

kyngchaos

Anonymous
I noticed that. But I'm not trying to execute any PHP. It's just some text in the page I'm trying to add. And it doesn't get blocked when I add the same text as a story.

Is there something different the way staticpages and stories pass html from the client to the server that could be the problem?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
I'm not familiar with it, but this appears to be a "feature" of mod_security.

bye, Dirk
 Quote

kyngchaos

Anonymous
OK. But then, why is it working with a story post (in html mode)? Can the static pages plugin be made to work the same way?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Hmm, good point. So either I was wrong (which is quite possible) or it's because there's an additional level of indirection with stories, as they are run through the template engine before they're displayed (static pages don't use templates).

bye, Dirk
 Quote

kyngchaos

Anonymous
Possibly. But I'm thinking it's on the other end - nothing ever makes it to the database, so there is nothing to display yet, in a template or not. So something is happening when the form posts to the geeklog staticpages.php.

Just a quick look at the html source on the client end:

Story uses a form with an enctype="multipart/form-data", while the staticpages doesn't set the enctype. I don't know much about enctype, maybe this could affect the POST data?

Story uses a textarea form item, so does staticpages but adds the wrap=virtual tag. I don't think that affects it since the text lines posted are short enough that no wrapping is needed.

I haven't looked at the PHP for stories and staticpages to see what happens on the server side.
 Quote

kyngchaos

Anonymous
Bingo!

Adding the enctype to the staticpages form did the trick. In particular, in the system/non-public GL stuff, plugins/staticpages/templates/admin/editor.thtml, add enctype="multipart/form-data" to the "frmstory" form. Now my PHP sample goes thru just like it does in a story post, without getting blocked by the server.
 Quote

All times are EST. The time is now 11:45 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content