Can I embed PHP in per/cgi scripts and vice versa somehow?

Discussion in 'PHP' started by wormy, Jul 15, 2006.

  1. #1
    Supposing I got an ads program like phpadsnew and I got a perl cgi script that I want to serve ads using phpadsnew(because its the king of free ad servers I hear). Is there a way to get perl to parse or fork parsing to another module?

    And would the matter be complicated if the perl script already loads persisntantly under mod_perl?
     
    wormy, Jul 15, 2006 IP
  2. DrMalloc

    DrMalloc Peon

    Messages:
    130
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You could use something like SSI or an iframe to throw the phpadsnew onto your perl page. Would mean not having to actually integrate the php logic into a perl script.
     
    DrMalloc, Jul 18, 2006 IP
  3. Cryogenius

    Cryogenius Peon

    Messages:
    1,280
    Likes Received:
    118
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You could make a http request to localhost to get the rendered output from your php script. A horrid and inefficient implementation, but it will work. The LWP::Simple package has a function called 'getprint' that would do the job.

    There may be a way to call the php interpreter directly, but I don't know how.

    Cheers, Cryo.
     
    Cryogenius, Jul 21, 2006 IP
  4. coderlinks

    coderlinks Peon

    Messages:
    282
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The PHP intrepreter can be called by running the command '/usr/bin/php -q php_script.php' . The problem is that you will be running the script in console mode and it won't get the $_REQUEST headers and stuff. If its a script that just does some process and gives the output, you can make it so that it accepts the data as command line arguments. Then within the script, you can access the data through $argc and $argv sort of like in C and C++.

    Thomas
     
    coderlinks, Jul 22, 2006 IP
  5. wormy

    wormy Active Member

    Messages:
    1,112
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #5
    Would it make more sense if I just run phpadsnew under a different subdomain registered as a vhost with apache? Because phpadsnew basically just "serves" ads as little tables, frames, or banners right? :confused:
     
    wormy, Jul 30, 2006 IP