Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-08-28 23:04:49

mascara
New Member
Registered: 2007-08-27
Posts: 9

help: can not save changes after adding some php

Hi everyone,

I’ve got this problem that has been driving me crazy. Basically, my server does not fopen so I use curl as described in this post:
http://gallery.menalto.com/node/36604#comment-133000

It works if I write a simple index.php file (you can see it at http://sandronesta.com/temp). But if I add this to my default page using text pattern, it does not allow me to save it! This is the error message I get:
“Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.”

Here is what I did exactly, in my default page, I add the following lines after an article tag and before </body>:

<txp:php>
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, ‘http://www.sandronesta.com/gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title’);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
echo $file_contents;
</txp:php>

It seems to me that it goes wrong once I add the $file_contents line. Can anyone please help? I’d very much appreciate any imput. I apologize if this is naive as I just got started and have searched for solutions like crazy.

Thanks so much!
marco

Offline

#2 2007-08-28 23:59:19

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: help: can not save changes after adding some php

Perhaps mod_security interfering there because it doesn’t like to see curl_exec?

Offline

#3 2007-08-29 00:02:23

mascara
New Member
Registered: 2007-08-27
Posts: 9

Re: help: can not save changes after adding some php

hey, thanks for the reply. How shall I fix it? Sorry I’m very new to this…

Thanks a lot,
-marco

Offline

#4 2007-08-29 00:20:53

mascara
New Member
Registered: 2007-08-27
Posts: 9

Re: help: can not save changes after adding some php

and, as mentioned before, if I include the code in an index.php file under /temp directory, it works. So it does not seem to be a server problem.

again, thanks very much for the help!

-marco

Offline

#5 2007-08-29 00:46:57

mascara
New Member
Registered: 2007-08-27
Posts: 9

Re: help: can not save changes after adding some php

solved, it’s exactly the mod_security problem. I found this thread at Drupal forum helpful.
http://drupal.org/node/51924

Thanks again for the help!

Offline

Board footer

Powered by FluxBB