exec() function doesn't work for me

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • henryrhenryr
    New Member
    • Jun 2007
    • 103

    exec() function doesn't work for me

    I'm trying to get exec() to work. It's a completely backend system so no security concerns.

    I want a button in my page to launch a programme on my windows system (for example notepad.exe) really just to save me some time. So I tried the following to test this :

    [CODE=php]
    $cmd='notepad.e xe'
    exec($cmd);
    [/CODE]

    After I run this script, nothing happens! But when I look at the process list on the windows task manager, I can see a new process - notepad.exe running. This process incidentally cannot be forced to quit without a restart.

    Can anyone shed any light?

    My system is: win2k pro, apache 2, php 5.2

    Thanks!
  • henryrhenryr
    New Member
    • Jun 2007
    • 103

    #2
    Originally posted by henryrhenryr

    [CODE=php]
    $cmd='notepad.e xe'
    exec($cmd);
    [/CODE]
    Sorry - typo:


    [CODE=php]
    $cmd='notepad.e xe';
    exec($cmd);
    [/CODE]

    Comment

    • mwasif
      Recognized Expert Contributor
      • Jul 2006
      • 802

      #3
      Why you want to run notepad via PHP?

      Comment

      • henryrhenryr
        New Member
        • Jun 2007
        • 103

        #4
        It's an example. I am trying to get the function to work and notepad seemed a suitable guinea pig.

        Once I have it working I'll write some .bat files which will launch other stuff and run some things (hopefully).

        I think the issue could be related to the setup of PHP or the OS? But I'm really on unsure ground when it comes to this.

        Comment

        Working...