#1  
Old 10th May 2012, 16:51
Ripeed Ripeed is offline
Member
 
Join Date: Oct 2011
Posts: 85
Thanks: 11
Thanked 1 Time in 1 Post
Question Python on ISPconfig3 server

Hi gurus, need help. I have working solution with ispconfig 3. About 30 web pages on server and etc.

When I try some test if python work like this:

Code:
def index(req):
   return "Test successfil";
Results is in browser: Test successful.

But when I try some webpage more complicated or script based on python then page visualization stops on the python code and than nothing.

I think somethings wrong with showing python.

Any ideas? Thanks for help.
Reply With Quote
Sponsored Links
  #2  
Old 23rd May 2012, 09:22
Ripeed Ripeed is offline
Member
 
Join Date: Oct 2011
Posts: 85
Thanks: 11
Thanked 1 Time in 1 Post
Default

This is that script that does not work on server.
Its OK until starts call

Code:
 include_once("./php_adlinks/adlinks.inc.php");
          echo adlinks_zobrazitListu("utf-8","curl");
Than the page is like without styles and the code of page ends until i call that.

Code:
<?

	
	define("SEO_LISTA_GETAD","http://adlinks.effectix.com/getad/getad.py?");
	

	function adlinks_zobrazitListu($encoding = "utf-8",$gettype = "fopen") {
		$RURL = "http://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
		$RURL = trim($RURL,"/");
		$RURL_ENCODED = urlencode($RURL);
		$data = "";
		switch ($gettype) {
			case "fopen":
				@$fp = fopen(SEO_LISTA_GETAD."q=$RURL_ENCODED", "r");
				if (!$fp) {
		      		@$fp = fopen(SEO_LISTA_GETAD."t=links&amp;q=$RURL_ENCODED", "r");
			    }
			    if ($fp) {
			      		while(!feof($fp)) {
				            $data .= fread($fp, 2048);
			      		}
			      		fclose($fp);
			    }
			    break;
			case "curl":
				$curl = curl_init();
				curl_setopt($curl, CURLOPT_URL, SEO_LISTA_GETAD."q=$RURL_ENCODED");
				curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
				$data = curl_exec($curl);
				$info = curl_getinfo($curl);
				curl_close($curl);
				if ($info['http_code'] == 307) {
					$curl = curl_init();
					curl_setopt($curl, CURLOPT_URL, SEO_LISTA_GETAD."t=links&amp;q=$RURL_ENCODED");
					curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
					$data = curl_exec($curl);
					curl_close($curl);
				}
				break;
			case "file_get_contents":
				$data = file_get_contents(SEO_LISTA_GETAD."q=$RURL_ENCODED");				
        $pos = strpos($http_response_header[0], "307");
    if ($pos === true) {
					$data = file_get_contents(SEO_LISTA_GETAD."t=links&amp;q=$RURL_ENCODED");
				}
				break;
		}
		if ($data != "") {
	    	    switch ($encoding) {
	      			case "windows-1250":
	      				$data = iconv("utf-8",$encoding,$data);
	      			break;
	      			case "iso-8859-2":
	      				$data = iconv("utf-8",$encoding,$data);
	      			break;
	      			default:
	      			break;
	      		}
	      		return $data;
	    }
	}
?>
Reply With Quote
  #3  
Old 23rd May 2012, 09:52
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,504
Thanks: 813
Thanked 5,265 Times in 4,129 Posts
Default

This script is php and not python.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #4  
Old 23rd May 2012, 09:57
Ripeed Ripeed is offline
Member
 
Join Date: Oct 2011
Posts: 85
Thanks: 11
Thanked 1 Time in 1 Post
Default

Thanks, I know that but with:

define("SEO_LISTA_GETAD","http://adlinks.effectix.com/getad/getad.py?");

I call .py and thats python... and on this its stops...

It works on old server and when I moved it on new server with debian and ISPconfig3 its not work

Last edited by Ripeed; 23rd May 2012 at 09:59.
Reply With Quote
  #5  
Old 23rd May 2012, 10:04
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,504
Thanks: 813
Thanked 5,265 Times in 4,129 Posts
Default

With that php code you load a external URL, it does not matter in which programming language a external script is coded that you load with curl as you will get html back. So you dont execute a local python script here and you dont need python support on your server.

My guess is that you just dont have the php curl module installed. Install it with:

apt-get install php5-curl

and restart apache.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #6  
Old 24th May 2012, 14:04
Ripeed Ripeed is offline
Member
 
Join Date: Oct 2011
Posts: 85
Thanks: 11
Thanked 1 Time in 1 Post
Default

Till, you have right, but when I try to update some package to install that feature it makes me trouble like this: Thread
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Debian 5 Ajax error + network interface always shutting down ev0css Installation/Configuration 3 5th June 2010 12:58
Webmail problems with only one domain? compner Installation/Configuration 14 16th February 2010 16:59
help--vodafone mobile connect card driver for linux seba Technical 7 13th June 2009 21:10
Rejecting outbound mail tristanlee85 General 11 20th May 2007 17:04
Webmail Relay Error palkat General 17 23rd April 2006 18:12


All times are GMT +2. The time now is 00:24.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.