SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast sportstoto3368's Avatar
    Join Date
    Apr 2004
    Location
    World
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP call to serverside vbscript failure

    Dear all,

    I'm using windows server with php. I am facing problem adding new user permission to the folder through php. Thus, I use php to execute/call sample.vbs located inside my server.

    I am facing big issue when want to combine the code. Probably I don't have idea, syntax wise and usage etc.

    Here's my sample code at php page
    -----------------------------------
    $WshShell = new COM("WScript.Shell");
    $oExec = $WshShell->Run("C:\sample.vbs", 3, false);

    I want to be able to call to this sample.vbs, and able to pass in 2 parameter. If not, I not able to setup the folder permission. The folder is created dynamically, so I can't hard code the folder name/path.



    C:\sample.vbs
    --------------

    Function SetPermissions(strHomeFolder, HttpDocsPath)

    Dim strHomeFolder, strHome, strUser
    Dim intRunError, objShell, objFSO

    strHomeFolder = "C:\testing"

    Set objShell = CreateObject("Wscript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")


    If objFSO.FolderExists(strHomeFolder) Then
    intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " _
    & strHomeFolder & " /e /c /g IUSR_NEOWAVE-004:F ", 2, True)

    If intRunError <> 0 Then
    Wscript.Echo "Error assigning permissions for user " _
    & strUser & " to home folder " & strHomeFolder
    End If
    End If


    End Function


    Any expert here having similar experience?
    Urgently need help on this.

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2008
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You tried performing
    Code:
    objShell.Run("&#37;COMSPEC% /c Echo Y| cacls " _
    & strHomeFolder & " /e /c /g IUSR_NEOWAVE-004:F ", 2, True)
    in PHP and it didn't work?

  3. #3
    SitePoint Enthusiast sportstoto3368's Avatar
    Join Date
    Apr 2004
    Location
    World
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi sk89, the portion quoted by you is working correctly.

    Finally I found the problem. The below should write as that way.


    $strHomeFolder= "c:\testing";
    $HttpDocsPath= "c:\testing2";

    $oExec = $WshShell->Run("C:\sample2.vbs " & $strHomeFolder . " " . $HttpDocsPath, 3, false);
    Last edited by sportstoto3368; Dec 15, 2008 at 00:17.

  4. #4
    SitePoint Wizard
    Join Date
    Mar 2008
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I was just wondering as to why you weren't executing calcs directly from PHP.

  5. #5
    SitePoint Enthusiast sportstoto3368's Avatar
    Join Date
    Apr 2004
    Location
    World
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its not working as well. I think is some setting inside windows server that I din do. I find all over the sites and followed many ways, but all not working for my server...


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
  •