
10th May 2012, 16:51
|
|
Member
|
|
Join Date: Oct 2011
Posts: 69
Thanks: 11
Thanked 1 Time in 1 Post
|
|
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.
|

23rd May 2012, 09:22
|
|
Member
|
|
Join Date: Oct 2011
Posts: 69
Thanks: 11
Thanked 1 Time in 1 Post
|
|
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&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&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&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;
}
}
?>
|

23rd May 2012, 09:52
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 32,071
Thanks: 697
Thanked 4,248 Times in 3,260 Posts
|
|
This script is php and not python.
|

23rd May 2012, 09:57
|
|
Member
|
|
Join Date: Oct 2011
Posts: 69
Thanks: 11
Thanked 1 Time in 1 Post
|
|
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.
|

23rd May 2012, 10:04
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 32,071
Thanks: 697
Thanked 4,248 Times in 3,260 Posts
|
|
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.
|

24th May 2012, 14:04
|
|
Member
|
|
Join Date: Oct 2011
Posts: 69
Thanks: 11
Thanked 1 Time in 1 Post
|
|
Till, you have right, but when I try to update some package to install that feature it makes me trouble like this: Thread
|

24th May 2012, 14:20
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 32,071
Thanks: 697
Thanked 4,248 Times in 3,260 Posts
|
|
Check the apache error.log (/var/log/apache/error.log) for errors, especiall for vlogger errors.
|

24th May 2012, 14:32
|
|
Member
|
|
Join Date: Oct 2011
Posts: 69
Thanks: 11
Thanked 1 Time in 1 Post
|
|

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?
|

24th May 2012, 16:50
|
|
Member
|
|
Join Date: Oct 2011
Posts: 69
Thanks: 11
Thanked 1 Time in 1 Post
|
|
If I change something in ISPconfig then I must kill Apache2 and start IT.
Help very appreciated
|

24th May 2012, 17:15
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 32,071
Thanks: 697
Thanked 4,248 Times in 3,260 Posts
|
|
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.
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 20:15.
|
|
Recent comments
3 hours 49 min ago
4 hours 49 min ago
8 hours 36 min ago
9 hours 50 min ago
13 hours 26 min ago
20 hours 41 min ago
1 day 5 hours ago
1 day 7 hours ago
1 day 22 hours ago
2 days 35 min ago