#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    334
    Rep Power
    246

    Wpebooks site replicator wordpress plugin hangs windows using exec()


    Hi,

    We purchased a site replicator plugin, only to find out it doesn't work on windows and support told me to fix it myself.

    I have replaced the following line..
    Code:
    // copy media
    $cp_base = ABSPATH . UPLOADBLOGSDIR . '/';
    $cp_cmd = str_replace( '//', '/', 'cp -r ' . $cp_base . $copy_id . ' ' . $cp_base . $new_id );
    
    exec($cp_cmd);
    with...
    Code:
    // copy media
    $cp_base = ABSPATH . UPLOADBLOGSDIR . '\\';
    $cp_cmd = str_replace( '/', '\\', ' xcopy ' . $cp_base . $copy_id . ' ' . $cp_base . $new_id );
    $cp_cmd .= ' /E /I /Q >NUL ';  
    				
    exec($cp_cmd);
    But the plugin just hangs. I beleive it is something to do with 'exec()' which causes problems with windows but as I don't do PHP I have no idea what the problem is or how to fix it.

    I've read the PHP exec() info and all the threads on suposed fixes, but so far can't find one that works.

    As you can see I've supressed all prompts from the command including output of copied files and even sent the 'xx files copied' final response from the command to NUL , I've also tried to capture any response via
    Code:
    $tmp = exec($cp_cmd);
    but nothing seems to work and the plugin just hangs?

    Any ideas how I fix this?

    Thanks,
    1DMF.
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    334
    Rep Power
    246
    Bump

    Is anyone able to run Exec() on windows and it not hang?
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!

IMN logo majestic logo threadwatch logo seochat tools logo