Click to See Complete Forum and Search --> : exec() Access Denied


Anon
03-03-2002, 05:28 PM
I'm running Win 2K Server and serving up pages via IIS.

Nothing on this server is directly exposed to the internet, nor will it ever be. I am trying to build an intranet app.

Without going into too much detail, I need to shell out at one point in my PHP app and schedule something on a workstation via AT. I can do it from command line, but from within PHP I get 'access denied'.

I understand that from IIS' perspective I'm not logged in as me, I'm logged in as IUSR_<server_name>. I have even gone so far as to give this user admin rights, still no joy.

For that matter, even something simple like this fails :

dir \\server_name\d$

If I try to exec() this directly, it cannoct fork. If I try to exec a batch file that does this, it's 'access denied'.

I *CAN* successfully exec() a dir on a share that I set up on the workstation, so I'm convinced this is a permissions issue.

Any help would be much appreciated.
______________________________________
John Pagakis
Email: john@pagakis.com

"You get older ... you start
having hopes for other people
rather than yourself."
-- Bob Dylan

This signature generated by
... and I Quote!!(tm) Copyright (c) 1999 SpaZmodic Frog Software, Inc.
www.spazmodicfrog.com

Anon
03-04-2002, 12:13 AM
I believe your problem lies in your php configuration. When "safe_mode = off", you can only execute executables from the "safe_mode_exec_dir" from which you specify. I hope this helps. Check out the docs: http://www.php.net/manual/en/features.safe-mode.php

Anon
03-04-2002, 12:59 AM
Thanks for your response, unfortunately, no joy.

When I try safe_mode = on, exec() returns nothing, and seems to do nothing.

With safe mode off, I can for example, do a dir of the d: drive on the server via exe, but cannot do dir \\workstation_name\d$ on another machine on the lan.

Leads me to believe this is a permission issue on the workstation.

_________________________________________
John Pagakis
Email: john@pagakis.com

"Whether you are [playing] in the bar,
the church, the strip joint, or the Himalayas, the first duty of music is
to complement and enhance life."
-- Carlos Santana

This signature generated by
... and I Quote!!(tm) Copyright (c) 1999 SpaZmodic Frog Software, Inc.
www.spazmodicfrog.com

mithril
03-04-2002, 03:06 AM
Why not map the network share and then call that mapped drive letter in your scripts?

-geoff

Anon
03-04-2002, 03:19 AM
Yeah, I'll probably wind up doing that. It means I'm going to have to re-write all my batch files though (:<(

What I'd *REALLY* like to do is get AT to schedule something on the workstation. It just doesn't want to let me do that <sigh> ...

__________________________________________________________________
John Pagakis
Email: john@pagakis.com

"If life is an illusion, I definitely overpaid for my suit."
-- Woody Allen

This signature generated by
... and I Quote!!(tm) Copyright (c) 1999 SpaZmodic Frog Software, Inc.
www.spazmodicfrog.com

michaelneo
03-04-2002, 08:47 AM
I have tried the same thing you are trying to do and NO LUCK>>>>>> I have mapped a network drive and am trying to access it using PHP and it will not even go into the network drive for some reason. If I try accessing stuff from the C:\, it works like a champion.

HELP!

Anon
03-04-2002, 09:36 AM
I feel your pain <g> ....

I have had success by setting things up as a share. You have to make sure the share has fairly liberal permissions.

Probably goes against all best practices, but ya gotta do what ya gatt do <sigh>.

Good Luck!!

__________________________________________________________________
John Pagakis
Email: john@pagakis.com

"Faced with the choice between changing one's mind and proving there
is no need to do so, almost everyone gets busy on the proof."
-- Kennith Gailbraith

This signature generated by
... and I Quote!!(tm) Copyright (c) 1999 SpaZmodic Frog Software, Inc.
www.spazmodicfrog.com

Anon
03-04-2002, 12:49 PM
Just something to try...

You've not run the IIS lockdown tool have you?

Anon
03-04-2002, 09:11 PM
Not to my knowledge.

Are you suggesting I run it, or not run it?

__________________________________________________________________
John Pagakis
Email: john@pagakis.com

"See, the problem is that God gives men a brain
and a penis, and only enough blood to run one at
a time."
-- Robin Williams

This signature generated by
... and I Quote!!(tm) Copyright (c) 1999 SpaZmodic Frog Software, Inc.
www.spazmodicfrog.com

Anon
03-06-2002, 01:16 AM
Well, it was a permissions problem.

Here's what you have to do to get exec() to work against a remote workstation (Win2K Professional):

- Go to the workstation in question.
- Go into Settings/Control Panel.
- Fire up Users and Passwords.
- A tabbed dialog comes up.
- Go to the Advanced Tab.
- Under the Advanced User Management section there is an Advanced button. Click it.
- An Explorer-style app comes up. In the tree on the left-hand side the is a folder called Groups. Click it.
- On the right-hand side there will be a group for Administrators. Double-clik it.
- This brings up a window that shows who is a member of the Administrator group on the workstation. Beneath that list is a button for Add. Click it.
- The resulting dialog shows a list of users you can add to the Administrator group. You are looking for "Authenticated Users". If ther aren't in the current list, there is a combo box above the list entitled "Look in:". Keep looking until you find "Authenticated Users". Add them to the Administrator group, save, and you are rockin' in the free world!!

__________________________________________________________________
John Pagakis
Email: john@pagakis.com

"He that is good with a hammer tends to think everything is
a nail."
-- Abraham Maslow

This signature generated by
... and I Quote!!(tm) Copyright (c) 1999 SpaZmodic Frog Software, Inc.
www.spazmodicfrog.com

Anon
03-06-2002, 05:39 PM
you will succes

Anon
03-07-2002, 05:17 AM
I have the same problem. I`m tring generate excel file at the shared disk. At the my local everithink is ok. But when i tried it at the map disk - //no sutch file or directory // Path is correct. I was tried made copy with this path it was OK. Bu t wna i was tried it fro PHP //no sutch file or directory//
thanks for any opinion

John Pagakis wrote:
-------------------------------
I'm running Win 2K Server and serving up pages via IIS.

Nothing on this server is directly exposed to the internet, nor will it ever be. I am trying to build an intranet app.

Without going into too much detail, I need to shell out at one point in my PHP app and schedule something on a workstation via AT. I can do it from command line, but from within PHP I get 'access denied'.

I understand that from IIS' perspective I'm not logged in as me, I'm logged in as IUSR_<server_name>. I have even gone so far as to give this user admin rights, still no joy.

For that matter, even something simple like this fails :

dir \\server_name\d$

If I try to exec() this directly, it cannoct fork. If I try to exec a batch file that does this, it's 'access denied'.

I *CAN* successfully exec() a dir on a share that I set up on the workstation, so I'm convinced this is a permissions issue.

Any help would be much appreciated.
______________________________________
John Pagakis
Emai....

Anon
03-07-2002, 07:48 AM
Read my post "exec() Access Denied- Mystery Solved!!" in this thread.

It is a permissions issue, and I was able to resolved it. There are step-by-step instructions there.
__________________________________________________________________
John Pagakis
Email: john@pagakis.com

Beaver: "Gee, there's something wrong with just about everything, isn't
there dad?"

Ward: "Just about, Beav"

This signature generated by
... and I Quote!!(tm) Copyright (c) 1999 SpaZmodic Frog Software, Inc.
www.spazmodicfrog.com

Anon
03-07-2002, 10:57 AM
What if the box you are trying to connect to is a Domain Controller?

Another thing is that I dont get any errors. If I try grabbing the file I need from the C:\ using PHP, it works. If I try to grab something from a network drive, it does not work with NO FREAKING ERRORS>> I dont get it.

Anon
03-07-2002, 02:08 PM
Michael -
Did you append 2>&1 to your exec() string?

Per the user comments on the exec() page at www.php.net --

<i>STDERR</i> is not handled and any output to will be passed to the browser as part of the page.

To stop this from happening you can append '2>&1' on the end of your command-line to redirect STDERR to STDOUT.


Good Luck -

JP