exec not working

Discussion in 'Developers' Forum' started by DUCKFACE, Jan 11, 2010.

  1. DUCKFACE

    DUCKFACE Banned

    im trying to amke kind of plugin .. but i stuck here ...

    so .. got $file_data[dir''] ... and i want to copy some files in it ...

    $source = "/usr/local/ispconfig/interface/web/bss/content";
    $target = $file_data['dir'].'/web';
    exec("cp -r ".$source." ".$target);
    exec("chmod -R a+r ".$target );
    but exec not working ...
    any idea ?
    ispconf3
    ________
    No2 Vaporizer
    ________
    Charlie Sheen Intern
     
    Last edited: Mar 17, 2011
  2. Ben

    Ben ISPConfig Developer ISPConfig Developer

    What is the errormessage you get? Depending on your log_level err message may not be displayed but stored to the webserver's logfile.

    Might be, that either safe mode is disallowing the usage of exec or the function is disbaled in general in your php.ini.

    Just another thing, whereever the content of $file_data['dir'], carfully verify it's content for validity.
     
  3. DUCKFACE

    DUCKFACE Banned

    error not visible

    the error msg is not visible probably of the log level.. but im wonder how exec is working when u add own error pages and in this case is not workin
    ________
    Ram
    ________
    CORVETTE C5-R
    ________
    BARBIEGIRRL
     
    Last edited: May 12, 2011
  4. Ben

    Ben ISPConfig Developer ISPConfig Developer

    Normally the default error level is to display all except notices or even including notices in some cases. So if this is not changed it should be either logged to the webserver's logfile or to your display.

    Are you talking about the same vhost where exec in custom errorpages is working and when you are trying to run your script? As you can influence / override some default settings on a vhost basis.

    Another issue could be that exec is working but the code passed throguh is wrong. So do you see any difference when warpping a var_dump() around the exec part as exec returns the last line of the command's result.
     
  5. DUCKFACE

    DUCKFACE Banned

    just copy it

    i copy the command for insert custom error pages .. to see is the problem from my script and it wont work again,
    for more clear view i put error_reporting(E_ALL);
    ini_set('display_errors', '1');
    and still no errors
    var_dump of source and target is string(46) "/usr/local/ispconfig/interface/web/bss/content" string(34) "/var/www/clients/client6/web10/web"
    finaly i have to exec cp -r /usr/local/ispconfig/interface/web/bss/content /var/www/clients/client6/web10/web
    when i execute rhis one from shell (as a root) ... its workin ...
    when i try to execute trought ispconfig ... no error .. no nothin .. even when im using the same script that puts custom error pages. i have no idea whats happened

    apache log:
    cp: cannot create directory `/var/www/clients/client6/web10/web/content': Permission denied
    chmod: changing permissions of `/var/www/clients/client6/web10/web': Operation not permitted
    chmod: cannot read directory `/var/www/clients/client6/web10/web': Permission denied

    if i have rights to cp error pages why i dont have rights to cp other?
     
    Last edited: Jan 13, 2010
  6. falko

    falko Super Moderator ISPConfig Developer

    Please make sure that PHP Safe Mode is disabled.
     
  7. DUCKFACE

    DUCKFACE Banned

    just asking myself

    why copying of error page is working with no problems .. but if u want to copy somethin esle with the same methods its not working ... what am i missing or is there any other limits for disable copy
    ________
    New jersey marijuana dispensary
    ________
    Walter Hayes
    ________
    Brunette Cam
     
    Last edited: May 12, 2011
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    You mix up interface and server. You can not use exec in the ispconfig interface as the interface runs under a non priviliged user for security reasons and does not has access to the customer websites. You have to write a server plugin if you want to run commands as root user.
     
  9. DUCKFACE

    DUCKFACE Banned

    thanks

    thanks till :)

    can anyone help with creating server plugin ?
    ________
    Ford Ma Concept Car
    ________
    ******* VIDS
    ________
    New Jersey Marijuana Dispensaries
     
    Last edited: May 12, 2011
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    Take a look at the existing server plugins in /usr/local/ispconfig/server/plugins-available to get an idea how they work. Every plugin must have a unique name. These plugins are event based, so depending on the event that you want to execute your code, write a new plugin which subscribes to the events. To activate the plugin, create a symlink in the plugins-enabled directory to the file in the plugins-available directory.
     
  11. DUCKFACE

    DUCKFACE Banned

    Last edited: May 12, 2011
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    The events get been called by ispconfig, so you can not launch them manually. You just bind a function in the local plugin to listen for a specific even. If you take a look at the existing, you will find the code in the onLoad function of the plugin. Example:

    $app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert');

    This binds the local function of the plugin with the name "insert" to the event "web_domain_insert".
     
  13. DUCKFACE

    DUCKFACE Banned

    how to be shure that plugin is working ?

    im binding the events .. linking enabled and available (link is with root permition if this is a clue), nameing the file and the class with same name ... but still not working ..
    how can i test if im using the plugin ?
    ________
    Essential vaaapp
    ________
    Magic flight
    ________
    Nevada Marijuana Dispensary
     
    Last edited: May 12, 2011
  14. till

    till Super Moderator Staff Member ISPConfig Developer

  15. DUCKFACE

    DUCKFACE Banned

    probably no

    maybe im doing somethin wrong ... this is the log file ...
    18.01.2010-17:17 - DEBUG - There is already a lockfile set. Waiting another 10 seconds...
    18.01.2010-17:18 - DEBUG - There is already an instance of server.php running. Exiting.
    18.01.2010-17:18 - DEBUG - There is already a lockfile set. Waiting another 10 seconds...
    18.01.2010-17:18 - DEBUG - There is already a lockfile set. Waiting another 10 seconds...
    18.01.2010-17:18 - DEBUG - There is already a lockfile set. Waiting another 10 seconds...
    18.01.2010-17:18 - DEBUG - There is already a lockfile set. Waiting another 10 seconds...
    18.01.2010-17:18 - DEBUG - There is already a lockfile set. Waiting another 10 seconds...
    18.01.2010-17:18 - DEBUG - There is already a lockfile set. Waiting another 10 seconds...
    18.01.2010-17:19 - DEBUG - There is already an instance of server.php running. Exiting.
    18.01.2010-17:19 - DEBUG - There is already a lockfile set. Waiting another 10 seconds...
     
  16. till

    till Super Moderator Staff Member ISPConfig Developer

    Then you have most likely a typo in the php code of your plugin which causes php to stop before the lockfile gets deleted. To debug this:

    1) Comment out the server.sh cronjob in the root crontab.

    2) Delete the lockfile:

    rm -f /usr/local/ispconfig/server/temp/.ispconfig_lock

    3) run:

    /usr/bin/php -q /usr/local/ispconfig/server/server.php

    as root user to get the php error message.
     
  17. DUCKFACE

    DUCKFACE Banned

    result

    this is the result ....
    18.01.2010-17:42 - DEBUG - There is already an instance of server.php running. Exiting.
    18.01.2010-17:48 - DEBUG - Set Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
    18.01.2010-17:48 - DEBUG - Found 1 changes, starting update process.

    why this is happening ..
    and should i get server.sh again to enable ?
    ________
    FORD CUSTOM HISTORY
    ________
    List of Honda motorcycles specifications
     
    Last edited: Mar 17, 2011
  18. till

    till Super Moderator Staff Member ISPConfig Developer

    Do steps 2 and 3 again.
     
  19. DUCKFACE

    DUCKFACE Banned

    till .. its the same ..

    probably somethin else is wrong ...
    i got the same results
    19.01.2010-17:41 - DEBUG - There is already a lockfile set. Waiting another 10 seconds...
    19.01.2010-17:41 - DEBUG - There is already a lockfile set. Waiting another 10 seconds...
    19.01.2010-17:41 - DEBUG - There is already a lockfile set. Waiting another 10 seconds...
    19.01.2010-17:42 - DEBUG - There is already a lockfile set. Waiting another 10 seconds...
    19.01.2010-17:42 - DEBUG - There is already a lockfile set. Waiting another 10 seconds...
    19.01.2010-17:42 - DEBUG - There is already a lockfile set. Waiting another 10 seconds...
    19.01.2010-17:42 - DEBUG - There is already a lockfile set. Waiting another 10 seconds...
     
  20. till

    till Super Moderator Staff Member ISPConfig Developer

    I dont think so. Make sure that you disabled the cronjob and then delete the lock file so often until it gets not created anymore automatically as there might be other processes waiting and then run the server script manually as I told you above.
     

Share This Page