Shell_exec problem!!!

Posted on 2004-11-19
Last Modified: 2013-12-13
Hi all;

 Well, I need to run a BAT application that is in the server. I'm able to run shell commands as DIR, CD or so, but when I execute the bat for the commerce application, it just opens a windows in order to download page.php...¿?¿?¿?...I'm bothered... why the system is returning me that page??.

The thing is that the BAT I have to run, needs a couple seconds to run.. maybe is this the problem??.. This is the code that works:
      $Cadena= "dir";
      //$output = shell_exec($Cadena);
      echo "<pre>$output</pre>";

And this is the one that is causing me the BIG problem:

      $Cadena= "C:\cyberpac\crurltpv C:\cyberpac\ C:\cyberpac\tpv.cnf idpedido:1000 importe:10.00 moneda:EUR idioma:esp";
      //$output = shell_exec($Cadena);
      echo "<pre>$output</pre>";

I've tries with system() but the result is the same. Safe Mode is off in my server...HELPPP!!!
Any real help will be rewarded!!!
Question by:jorvidu
    LVL 48

    Accepted Solution

    The \ might cause problems:
     $Cadena= 'C:\cyberpac\crurltpv C:\cyberpac\ C:\cyberpac\tpv.cnf idpedido:1000 importe:10.00 moneda:EUR idioma:esp';
    (' instead of ")
    LVL 1

    Author Comment


    That's the solution... when someone is 134234 hours in front the same problem and just can't see through that obvious things, you're there!!!. THANKS AGAIN!!

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    As this topic comes over and over again in different forms, I've finally decided to write a short (yea, right...) article / tutorial about pagination with PHP with MySQL database. There are dozens of these kind of tutorials, I know - I wanted to mak…
    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now