enrico pagotto
enrico pagotto

Reputation: 21

opendir on IIS10 and PHP 8

I have recently been setting up a corporate server to put my website online.

Previously this website was hosted on my pc using XAMPP with PHP 5; now I have Windows Server 2019 and PHP 8. Everything works, but something is wrong in opendir() and scandir(): it says folders are either non-existent or cannot be accessed.

My company has multiple servers and I have to log in via PHP to process other data there, but you can't log in via PHP. With folder browsing on Windows Server everything is accessible and visible, while PHP fails.

Could you help me? I'm really ignorant of the subject...

The very simple code is this:

$directory="//artioscad/Artios/Designs/rapporti di lavoro/Done/";
$directory_handle=opendir($directory);
$c=scandir($directory);

The error that appears is this:

PHP Warning:  opendir(//artioscad/Artios/Designs/rapporti di lavoro/Done/): Access is deni (code: 5) in C:\inetpub\wwwroot\amministrazione\rapportini.php on line 59
PHP Warning:  opendir(//artioscad/Artios/Designs/rapporti di lavoro/Done/): Failed to open directory: No such file or directory in C:\inetpub\wwwroot\amministrazione\rapportini.php on line 59
PHP Warning:  scandir(//artioscad/Artios/Designs/rapporti di lavoro/Done/): Access is deni (code: 5) in C:\inetpub\wwwroot\amministrazione\rapportini.php on line 63
PHP Warning:  scandir(//artioscad/Artios/Designs/rapporti di lavoro/Done/): Failed to open directory: No such file or directory in C:\inetpub\wwwroot\amministrazione\rapportini.php on line 63
PHP Warning:  scandir(): (errno 2): No such file or directory in C:\inetpub\wwwroot\amministrazione\rapportini.php on line 63

I have also changed the permissions of the IUSR user, but it still doesn't work...IUSR permissions

Upvotes: 2

Views: 446

Answers (1)

Vitaly Eremenko
Vitaly Eremenko

Reputation: 1

Now PHP-8.2.9 opendir() and readdir() work OK.

I opened localhost Win10 Pro IIS my sites. But all my changes for access to "DataDir" did not give results. It was insufficient "Authenticated Users" in Permission Dialog under Security tab for "DataDir" on the site.

I renamed "DataDir_P" (in Win10) and created "DataDir" as new with default Win10 settings. The Data Files copyed from "DataDir_P".

Then I made restart all sites (by IIS Win10) on the localhost. I can read now list of files in "DataDir" with PHP.

Upvotes: 0

Related Questions