Re: @EXEC command not work :(

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Stephane,
Hi Niel,

> > ...
> > but if we move the PHP script from \\xxx.xxx.xxx.xxx\scriptdir\
> > to c:\scriptdir\ then it's work !!
> ...
> Is this operating in a CLI or web-server environment? If it is
> web-server then it is probably a permissions issue. By default
> Apache/PHP do NOT have permissions to access network resources. You must
> create a user to run Apache and give that user the permissions needed.
> This of course assumes you're using Apache, but I would guess similar
> problem would happen with IIS.

I ran into similar problems some years ago and I assume you run into comparable problems as I did:

---------------
Problem source:
---------------

* if you access a remote share interactively (i.e. through Windows Explorer), your stored user account information is validated on the remote computer and if the logged in user is allowed to access the share, you won't even know that an authentication happened.
* if the webserver (running under the localsystem account) tries to load or execute a remote script, the same authentication method happens but the localsystem accounts on the two computers (local web server and remote file server) are not the same, authentication fails causing exec() to fail too.

-----------------
Access debugging:
-----------------

* if the remote file server is a Windows 2000 and newer system, activate object access logging (through MMC, snap-in "Local Computer Policy" -> Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> Audit Policy, option "Audit object access"
> after activating object access, rightclick one of the scripts that will be executed by the web server and set the object access options under "properties" -> "Advanced" -> "Auditing", add everyone and both successes and failures

Now execute the script on the web server and then check your file server's event log, security node if there are any failures logged.

-----------------------
How to solve the issue:
-----------------------

* add a user account with the same passwords on both the local web server and remote file server, change the service owner for Apache2/IIS to use the new account. If you are on a domain, it's even better to add a domain user with the same SID and use this one. Restart the service and check if the web server behaves normally, then retry the test.

* use the PSTools from Sysinternal to execute remote scripts. The tool PSExec takes a user name and password when calling remote script and first authenticates on the remote system before executing scripts (see http://technet.microsoft.com/de-de/sysinternals/bb897553.aspx)

Hope this helps!

Regards, Sascha
-- 
Freundliche Grüße / Kind regards,

Sascha Meyer
--------------------------------------------------
EE:  http://www.experts-exchange.com/M_761556.html
ZCE: http://www.zend.com/en/yellow-pages#show-ClientCandidateID=ZEND011290

GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux