Re: getting php to do an exec()

From: clvrmnky (clvrmnky-uunet_at_coldmail.com.invalid)
Date: 11/24/03

  • Next message: Bas Keur: "Re: 3.4 evolution start problem after reboot"
    Date: Mon, 24 Nov 2003 17:22:58 -0500
    
    

    DejaVU wrote:
    > Hiya all
    >
    > Battling here a bit, being in a hurry to get this working
    >
    > Loaded 3.4 on a SPARC 5 yesterday
    > Configured Apache
    > Loaded PHP core 4.3.3
    > modified httpd.conf to parse .html files
    >
    > I have transferred the pages I need to this server, and it serves
    > them, BUT the php script I've been using on my FreeBSD box won't work
    > because the critical call
    > exec("ls -1", $files)
    > fails
    >
    > On my FreeBSD box (shortly to lose it's hardware, like hours away)
    > this works just fine, getting the current directory listing. That is
    > running FreBSD5.0-RELEASE with Apache 2 and PHP 4.2.3 (all from the
    > ports collection at the time of install a few months back).
    >
    > I cannot recall changing anything to make the exec() work, have not
    > noted it in my server log, and cannot find any of my usual 'i changed
    > this' tags in the ini files
    >
    > How do I get this to work quickly?

    Might try comp.lang.php, as this is definitely a PHP/Apache issue, not
    an OS issue (specifically).

    However, the first thing I'd do is make sure it isn't a pathing problem.
      Try an absolute path. The following works for me:

    $fortune = exec("/usr/games/fortune -s", $fortunearray);
    if ($fortune == "")
        $fortunearray = array ("You have no fortune." );

    I've heard that recent installs of Apache on OBSD are now chroot'd. If
    this is so, the PHP module is running in the httpd environment, and may
    see "/var/www" as "/". So, unless you have a local "ls", you may be SOL.


  • Next message: Bas Keur: "Re: 3.4 evolution start problem after reboot"

    Relevant Pages

    • Re: FreeBSD for webserver?
      ... published security vulnerabilities. ... I don't use PHP, but I used to create a separate user for each webapp ... But being a FreeBSD fan, ... Should I use Ports or Packages to install all these tools One by One? ...
      (freebsd-questions)
    • Re: WordPress, Apache, modules, mod_rewrite - how to verify?
      ... Anyway, I'm a MS SQL Server guy, trying to mess around with FreeBSD at ... I just install ed WordPress from ports, ... trying to use it to learn PHP and MySQL. ... but outside of work, I would like to learn some PHP, Perl ...
      (freebsd-questions)
    • Re: What FreeBSD users really want
      ... Install from ports and you're done. ... Then some install php ... In FreeBSD there is a complete system, base, maintained by the FreeBSD ... Your current website looks very ordinary and doesn't make any impression ...
      (freebsd-questions)
    • Re: about MySQL
      ... Use the ports system to install both Apache and PHP. ... You can start learning FreeBSD by read the material available here: ...
      (freebsd-questions)
    • Re: Noob - php works as .php but not when part of html
      ... > from Geoff Berrow contained the following: ... > Oops. ... Thanks, but what I posted was a type - in my actual code, the <?php line ... What do you mean 'unless you have configured Apache otherwise...'? ...
      (comp.lang.php)