Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #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,717
Thanks: 820
Thanked 5,322 Times in 4,175 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,717
Thanks: 820
Thanked 5,322 Times in 4,175 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
  #7  
Old 24th May 2012, 14:20
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,717
Thanks: 820
Thanked 5,322 Times in 4,175 Posts
Default

Check the apache error.log (/var/log/apache/error.log) for errors, especiall for vlogger errors.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #8  
Old 24th May 2012, 14:32
Ripeed Ripeed is offline
Member
 
Join Date: Oct 2011
Posts: 85
Thanks: 11
Thanked 1 Time in 1 Post
Default


I am very confused about that:

/var/log/apache2/error.log
Code:
[Thu May 24 10:27:41 2012] [error] [client CENSORED] PHP Notice:  Undefined index: on_after_update in /usr/local/ispconfig/interface/lib/classes/plugin.inc.php on line 139
[Thu May 24 10:27:41 2012] [error] [client CENSORED] PHP Notice:  Undefined index: dns:on_after_update in /usr/local/ispconfig/interface/lib/classes/plugin.inc.php on line 139
[Thu May 24 10:27:41 2012] [error] [client CENSORED] PHP Notice:  Undefined index: dns:dns_soa:on_after_update in /usr/local/ispconfig/interface/lib/classes/plugin.inc.php on line 139
[Thu May 24 10:27:51 2012] [error] [client CENSORED] PHP Notice:  Undefined index: on_after_insert in /usr/local/ispconfig/interface/lib/classes/plugin.inc.php on line 139
[Thu May 24 10:27:51 2012] [error] [client CENSORED] PHP Notice:  Undefined index: dns:on_after_insert in /usr/local/ispconfig/interface/lib/classes/plugin.inc.php on line 139
[Thu May 24 10:27:51 2012] [error] [client CENSORED] PHP Notice:  Undefined index: dns:dns_txt:on_after_insert in /usr/local/ispconfig/interface/lib/classes/plugin.inc.php on line 139
[Thu May 24 10:28:02 2012] [notice] caught SIGTERM, shutting down
[Thu May 24 10:32:30 2012] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Thu May 24 10:32:30 2012] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Thu May 24 10:32:30 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Thu May 24 10:32:30 2012] [notice] Digest: generating secret for digest authentication ...
[Thu May 24 10:32:30 2012] [notice] Digest: done
Use of uninitialized value $DBI_DUMP in alarm at /usr/local/ispconfig/server/scripts/vlogger line 538.
[Thu May 24 10:32:30 2012] [error] python_init: Python version mismatch, expected '2.6.5+', found '2.6.6'.
[Thu May 24 10:32:30 2012] [error] python_init: Python executable found '/usr/bin/python'.
[Thu May 24 10:32:30 2012] [error] python_init: Python path being used '/usr/lib/python2.6/:/usr/lib/python2.6/plat-linux2:/usr/lib/python2.6/lib-tk:/usr/lib/python2.6/lib-old:/usr/lib/python2.6/lib-dynload'.
[Thu May 24 10:32:30 2012] [notice] mod_python: Creating 8 session mutexes based on 256 max processes and 0 max threads.
[Thu May 24 10:32:30 2012] [notice] mod_python: using mutex_directory /tmp 
[Thu May 24 10:32:30 2012] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Thu May 24 10:32:30 2012] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Thu May 24 10:32:30 2012] [notice] Apache/2.2.16 (Debian) DAV/2 mod_fcgid/2.3.6 PHP/5.3.3-7+squeeze9 with Suhosin-Patch mod_python/3.3.1 Python/2.6.6 mod_ruby/1.2.6 Ruby/1.8.7(2010-08-16) mod_ssl/2.2.16 OpenSSL/0.9.8o configured -- resuming normal operations
[Thu May 24 10:33:48 2012] [error] [client CENSORED] PHP Notice:  Undefined variable: html_server in /usr/local/ispconfig/interface/web/monitor/show_sys_state.php on line 237
[Thu May 24 10:33:48 2012] [error] [client CENSORED PHP Notice:  Undefined index: nezn\xc3\xa1m\xc3\xbd in /usr/local/ispconfig/interface/web/monitor/show_sys_state.php on line 255
[Thu May 24 10:33:48 2012] [error] [client CENSORED] PHP Notice:  Undefined index: info in /usr/local/ispconfig/interface/web/monitor/show_sys_state.php on line 256
Do you see from that something what I can repair?
Reply With Quote
  #9  
Old 24th May 2012, 16:50
Ripeed Ripeed is offline
Member
 
Join Date: Oct 2011
Posts: 85
Thanks: 11
Thanked 1 Time in 1 Post
Default

If I change something in ISPconfig then I must kill Apache2 and start IT.

Help very appreciated
Reply With Quote
  #10  
Old 24th May 2012, 17:15
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,717
Thanks: 820
Thanked 5,322 Times in 4,175 Posts
 
Default

Try to find out what you changed or installed which causes thes e apache instabilitys and then undo these steps. According to the error log something in the python installation is broken:

Python version mismatch, expected '2.6.5+', found '2.6.6'

so if you dont need python on that server then you should consdier to remove mod_python.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
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 06:15.


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