Results 1 to 7 of 7

Thread: PHP - print string and execute next script

  1. #1
    Join Date
    Mar 2010
    Posts
    203

    PHP - print string and execute next script

    Hello,
    I have a php code and would like to execute the next php script after printing the string of the first script. Can this be done? If you have any knowledge about this then please let me know. Thank you for your help.

  2. #2
    Join Date
    Nov 2009
    Posts
    343

    Re: PHP - print string and execute next script

    Hello,
    I think this can be done when you are going to use some cache concept wihth your script.
    Here are few codes rather part of codes that can help you
    Code:
    exec('/home/path and the php source code > /tmp/temp location if you need')
    Code:
    exec('/home/path and the php source code > /dev/null > /tmp/temp location if you need ')
    And
    Code:
    alias pexec='php /home/path and file name'
    Though I am not sure that this is what you need.

  3. #3
    Join Date
    Nov 2009
    Posts
    335

    Re: PHP - print string and execute next script

    Hello,
    Try the following script and see if this works
    Code:
    $scr = $argv[1]
    $prms = implode(' ', array_slice($argv, 2));
    $c    = "{$scr} {$prms} > /dev/null &";
    
    $output = array();
    $return = 0;
    exec("php {$c}", $output, $return);
    
    exit((int)$return);

  4. #4
    Join Date
    Nov 2009
    Posts
    347

    Re: PHP - print string and execute next script

    Hey,
    Take a look at the following code
    Code:
    <?php
    include('config.php');
    $database = mysql_connect($dbserver, $dbuser, $dbpass);
    my_sql($dbname,$database);
    $sq = "SELECT id,big,thumb,postdate, DATE_FORMAT(postdate, '%d/%m/%Y @ %T ') AS pdate FROM screenshots ORDER BY id DESC";
    $query = mysql_query($sq,$database);
    $rslt = mysql_num_rows($query);
    $limit = "12"; //limit of archived results per page.
    $total_pages = ceil($rslt / $limit); //total number of pages

  5. #5
    Join Date
    Mar 2010
    Posts
    184

    Re: PHP - print string and execute next script

    Hello,
    I am new to php, I have a script see if this is what you need.
    Code:
    <?php
    function exec_enabled() {
      $dis = explode(', ', ini_get('disable_functions'));
      return !in_array('exec', $dis);
    }
    ?>

  6. #6
    Join Date
    Nov 2009
    Posts
    583

    Re: PHP - print string and execute next script

    Hello,
    Try this
    Code:
    <?php
    function exback($cmd) {
        if (string(phpusr(), 0, 7) == "Windows"){
            pclose(popen("start /B ". $cmd, "r")); 
        }
        else {
            exec($cmd . " > /dev/null &");  
        }
    }
    ?>

  7. #7
    Join Date
    Nov 2009
    Posts
    583

    Re: PHP - print string and execute next script

    Hello,
    Check out the following code
    Code:
    <?php
    
    function exe($c)
    {
       $wsh = new COM("WScript.Shell");
       $c= getcwd();
       if (strpos($cwd,' '))
       {  if ($pos = strpos($c, ' '))
          {  $c = substr($c, 0, $pos) . '" ' . substr($c, $pos);
          }
          else
          {  $c .= '"';
          }
          $cwd = '"' . $cwd;
       }  
       $oExec = $wsh->Run("c /C \" $cwd\\$c\"", 0,true);
      
       return $oExec == 0 ? true : false;
    }
    ?>

Similar Threads

  1. Can not execute ASP script on IIS7 in Windows 7
    By Mindstorm in forum Software Development
    Replies: 6
    Last Post: 16-01-2010, 10:03 AM
  2. Create a php script to replace a string in multiple files
    By KADEEM in forum Software Development
    Replies: 4
    Last Post: 23-11-2009, 05:09 PM
  3. Is it possible to execute Perl script within another script?
    By RasMus in forum Software Development
    Replies: 2
    Last Post: 21-07-2009, 10:57 PM
  4. how to call or execute mySql script in php?
    By Quattro in forum Software Development
    Replies: 3
    Last Post: 03-07-2009, 11:53 PM
  5. Need Perl script to execute from another.
    By beelow in forum Software Development
    Replies: 2
    Last Post: 20-06-2009, 09:17 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,024,717.18407 seconds with 16 queries