Results 1 to 7 of 7

Thread: Python and PHP?

  1. #1
    Join Date
    Feb 2011
    Posts
    39

    Python and PHP?

    Is it possible to incorporate applications written in Python into a website using a PHP framework?

  2. #2
    Join Date
    Apr 2008
    Location
    United States, MI
    Posts
    766
    PHP Code:
    $content shell_exec("/usr/bin/python /path/to/python/script.py");
    sanitize_and_print($content); 
    Of course your python path may differ.
    Steven Crothers
    No BS cloud engineer and Red Hat architect.

  3. #3
    if you need python on centos and want 2.4 then youll need to install it from source

  4. #4
    Join Date
    Mar 2011
    Posts
    41
    I think you could also use services to communicate between them.

  5. #5
    i think you can but for security reason, python might not be good.

  6. #6
    Yes, this is possible. For that you will need a Python extension for PHP. This extensions allows the Python interpreter to be embedded inside of PHP. This allows the native Python objects to be instantiated and manipulated from within PHP.

  7. #7
    Join Date
    Sep 2004
    Location
    Cluj-Napoca, Romania
    Posts
    462
    Quote Originally Posted by SeekIt View Post
    Is it possible to incorporate applications written in Python into a website using a PHP framework?
    Depends on what you want to do exactly.
    You can also have URLs below /py/... to be threated by Python for instance. And the database may be common. I've implemented stuff like this.

Similar Threads

  1. php vs. python
    By hq12 in forum Programming Discussion
    Replies: 7
    Last Post: 12-31-2009, 02:35 PM
  2. PHP and/or Python Web Developer
    By e-Sensibility in forum Employment / Job Offers
    Replies: 5
    Last Post: 12-02-2009, 12:23 AM
  3. PHP and Python for Web Programming.
    By AndrewBC in forum Programming Discussion
    Replies: 17
    Last Post: 08-05-2008, 09:24 AM
  4. PHP vs Python - LOL
    By jt2377 in forum Programming Discussion
    Replies: 1
    Last Post: 03-17-2007, 04:45 AM
  5. Comparing PHP, Python (and maybe Ruby, Java too)
    By mwatkins in forum Programming Discussion
    Replies: 51
    Last Post: 12-14-2006, 09:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •