"PROBLEM WITH xp_cmdshell"

  • Hello,

    I have a problem running xp_cmdshell in a stored procedure when I call it from php.

    execute the procedure, among other things, that:

    EXEC @ result = xp_cmdshell @ strsql

    IF (@ result = 0)

    insert dbo.Error ('Success')

    ELSE

    insert dbo.Error ('Failure')

    If I run the prc from transact sql works correctly, however when I invoke the prc from php, the prc hangs in the call to

    EXEC @ result = xp_cmdshell @ strsql

    And no longer inserted into the table or 'Success' or 'Failure'.

    how I can fix it??

    Thanks!!!

  • It might be permission issues perhaps.

    Did you tried connecting sql server using php application uses for db connection and call cmdshell?

    One other reason may be that the server is not configured for allowing xp_cmdshell. But I see that you have already managed to make it work.

  • simple .... avoid xp_cmdshell.

    There must be more optimal ways to perform the same thing without having to open xp_cmdshell and accept the risks that come with it.

    Did you grant exec for the user on xp_cmdshell ?

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply