Access to Network Shares fails opendir code 58
Posted by: mac.and.cheese (---.sd.sd.cox.net)
Date: March 20, 2022 08:32PM

Windows 10 System w/ WAMPServer 3.2.8 PHP 7.4.28 (totally new install). OLD Windows 7 WAMPServer 2.4 code works giving me access on all my Network Shares. Needed to move to Windows 10 - same PHP code fails.

Access to Network Shares fails opendir code 58

opendir path:\\DAR-DS920\dar-data\PLEX
( ! ) Warning: opendir(\\DAR-DS920\dar-data\PLEX,\\DAR-DS920\dar-data\PLEX): The
specified server cannot perform the requested operation. (code: 58) in C:\wamp64\www\smb
\1_smb_list.php on line 35


Network Share is a Synology NAS SMB1/2/3 enabled.

Using Windows 7 WAMPSERVER 2.4 or Windows 10 with XAMPP access works.

I assume it related to SMB2/3. On the Windows 10 system I enabled SMB1 Client and was able to access my WDTVLiveHub ( SMB1) share with out errors.

Options: ReplyQuote
Re: Access to Network Shares fails opendir code 58
Posted by: Otomatic (Moderator)
Date: March 21, 2022 09:36AM

Hi,

The wampapache64 service on computer must be launched with the admin account and not the local system account.
So, leave Wampserver, services manager, wampapache64 service, properties, connection tab:
-This account radio button
- Browse, Advanced, Search, validate the administrator account (in this case dominique DOMI) - Attention not the account marked Administrator).
- OK twice
- Fill in the Password and Confirm Password fields correctly
- Apply, then OK
Note: This is a translation of the terms I see on my French Windows. They may not be those terms on an English Windows.

Start Wampserver
To check that the wampapache64 service is no longer LocalSystem, Right-click -> Tools -> Check Service Status and you should see that it is no longer LocalSystem for Apache:
State of services:
 The service 'wampapache64' is started
 Service Session : .\dominique
 The service 'wampmysqld64' is started
 Service Session : LocalSystem
 The service 'wampmariadb64' is started
 Service Session : LocalSystem
	all services are started - it is OK
	all services BINARY_PATH_NAME are OK

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.10 32 bit - Apache 2.4.54 - PHP 8.2.0…5.6.40 - MySQL 5.7.39 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.10 64 bit - Apache 2.4.54 - PHP 8.2.0…5.6.40 - MySQL 5.7.39/8.0.30 - MariaDB 10.5.17/10.9.2
PhPMyadmin 5.2.0 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote
Re: Access to Network Shares fails opendir code 58
Posted by: mac.and.cheese (---.sd.sd.cox.net)
Date: March 21, 2022 09:49PM

Problem resolved...

Was able to use the "admin account" (normal Login account) for my system. Only problem was account must use a password for login which I did not use, once password added Service started okay.

On one other system I had to add the "admin account" to the list of "Log on as a service". Found this:

1.Logon to the computer with administrative privileges.
2.Open the ‘Administrative Tools’ and open the ‘Local Security Policy’
3.Expand ‘Local Policy’ and click on ‘User Rights Assignment’
4.In the right pane, right-click ‘Log on as a service’ and select properties.
5.Click on the ‘Add User or Group…’ button to add the new user.
6.In the ‘Select Users or Groups’ dialogue, find the user you wish to enter and click ‘OK’
7.Click ‘OK’ in the ‘Log on as a service Properties’ to save changes.

All is working Now on my Windows 10 Systems.

Thank You

Options: ReplyQuote
Re: Access to Network Shares fails opendir code 58
Posted by: mac.and.cheese (---.sd.sd.cox.net)
Date: March 21, 2022 11:14PM

Follow Up... I have leaned a lot from this process. I had said that XAMPP worked, what I learned was I loaded Apache as a program and not as a Service. When I loaded it as a Service my php script failed with code 58, too.

The solution of using the "admin account" on their service worked.

I just did want to imply that XAMPP was working better then WampServer, as I prefer WAMP, I am a long time user over. Seems Windows 10 Service Login is the real issue here and not the Web Server!

Options: ReplyQuote
Re: Access to Network Shares fails opendir code 58
Posted by: supaman2u (99.42.79.---)
Date: March 22, 2022 04:56PM

Also keep in mind that Network Shares are (by design) a "per-user" permission for a currently logged in user. The LocalSystem account does have some restrictions, especially if you are wanting a service to run and access shares when a user isn't logged in. There was (may still be) a tool from SysInternals for setting up network shares under the LocalSystem account so that services can access them even when no one is logged into the system. May not specifically be your issue, but it is something good to know if you ever wonder "why can't <service> access a <network share> when I'm not logged in", because that is why.

Options: ReplyQuote


Sorry, only registered users may post in this forum.