tags:

views:

96

answers:

3

I have a VPS Linux webserver with php installed. I want to code some search engine or data mining stuff in one application which i am thnking of building i python.

I want to know that is it possible that i can use python and php together

like calling function of python in php and vice versa

As it is my VPS server i can install anything on that. Has anyone tried using python in php . Any performance issues in real time??

+3  A: 

You can execute python scripts using the exec() function in your php script.

Also this seems to provide an answer or two to your question.

http://stackoverflow.com/questions/166944/calling-python-in-php

DRL
A: 

You're trying to do something like

def helloWorld():
    print 'Hello, World'

<?php helloWorld(); ?>

I'd say that you most certainly can't.

Edit: Have a look at php's shell_exec though.

cypher
+2  A: 

You could have a look at PiP

To that end, I've [site author] written a Python extension for PHP. In short, this extensions allows the Python interpretter to be embedded inside of PHP (think of PHP as the parent language with Python as its child). This allows native Python objects to be instantiated and manipulated from within PHP. There is also initial support for accessing PHP functions and data from within the embedded Python environment.

However, I cannot comment on its reliability. Might need to test it for yourself.

Russell Dias