Site shows "Permissions denied" on /wp-includes/functions.php

What issue or error are you experiencing?

Warning: file_get_contents(C:/Users/user1/Local Sites/site1/app/public/wp-content/themes/sitetheme1/resources): failed to open stream: Permission denied in C:\Users\user1\Local Sites\site1\app\public\wp-includes\functions.php

The previous error shows up after upgrading to wordpress 6.3. This error does not show in wordpress 6.2. I tried changing all permissions of the functions file and its parent directory to full access. I am wondering if this is partially due to the difference between the windows filesystem that holds the files and then Local WP converting that filesystem into some kind of virtual machine in order to serve the site on a Linux environment server. I read that the earlier version of Local Classic used VM software very similar to what Oracle Virtualbox uses. Anyone know the inner workings of Local Lightning and how it deals with file permissions when installed on a windows computer?


What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc

Upgrade to wordpress 6.3.1 on an existing site already pulled to Local WP. Try checking permissions of the function.php file in Windows and make sure all access is allowed for that file.


System Details

  • Local Version:
    7.1.2+6410

  • Operating System (OS) and OS version:
    Windows 10


Local Logs

Attach your Local Logs here (Help Doc - Retrieving Local’s Log)

2023/08/30 18:50:45 [error] 12864#12876: *5 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: 127.0.0.1, server: site.local, request: “GET /wp-admin/admin.php?page=aiowpsec_filesystem HTTP/2.0”, upstream: “http://127.0.0.1:10004/wp-admin/admin.php?page=aiowpsec_filesystem”, host: “site.local”, referrer: “https://site.local/wp-admin/admin.php?page=aiowpsec_settings&tab=advanced-settings”

2023/08/30 18:51:42 [crit] 12864#12876: *16 SSL_write() failed (10053: An established connection was aborted by the software in your host machine) while sending to client, client: 127.0.0.1, server: site.local, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:10010/”, host: “site.local”, referrer: “https://site.local/”

2023/08/30 19:19:49 [alert] 13232#10816: OpenEvent(“ngx_master_2448”) failed (2: The system cannot find the file specified)


Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

Hi @spbos

Do you have any antivirus, security, or firewall applications that could be blocking Local?

More details about troubleshooting this here: Router Mode

And here:

Could you share your full Local Log here as well? For us to be able to troubleshoot thoroughly, please click the Download Local Logs button from the Support tab in Local. This will generate a zip archive that contains the Local log along with some other diagnostic information to help quickly zero in on any issues that Local is encountering.

Hi @Nick-B thanks for your reply. I don’t have any antivirus or firewall applications other than the standard Microsoft Defender which showed the Local application to be allowed to communicate through the windows defender firewall. I tried switching to localhost Router mode and got the “site refused to connect” error in the browser. We are trying to pin down why this happens only in Wordpress 6.3 and doesn’t happen in 6.2. Perhaps Wordpress 6.3 has new changes to its ability to modify files and permissions and it just happens to reach a breaking point within the Local app. I checked the permissions of the hosts file on my computer and it already had all permissions granted before touching it.

Here are some snippets of the various log files that are provided by the Download Local Logs button:
local-lightning-verbose.log

{"thread":"main","class":"SshService","message":"Could not create directory '/home/user1/.ssh'.\r\nWarning: Permanently added 'user1test.ssh.wpengine.net,35.224.26.249' (RSA) to the list of known hosts.","level":"warn","timestamp":"2023-09-12T19:03:14.823Z"}

{"thread":"main","class":"SshService","message":"Success: Exported to 'sites/user1/_wpeprivate/autoload.sql'.\ntable_prefix=w9th_","level":"verbose","timestamp":"2023-09-12T19:03:14.823Z"}

{"thread":"main","class":"RsyncService","message":"Running rsync with following args: '-avzum', '--relative', '-e', 'ssh -o PubkeyAcceptedKeyTypes=+ssh-rsa -o ServerAliveInterval=60 -o ServerAliveCountMax=120 -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=\"/cygdrive/c/Users/user1/.ssh/known_hosts\" -i \"%%userDataPath%%\\ssh\\wpe-connect\"', 'local+rsync+user1@user1.ssh.wpengine.net:/sites/user1/./_wpeprivate/autoload.sql', '/cygdrive/c/Users/user1/Local Sites/user1/app/public/'","level":"debug","timestamp":"2023-09-12T19:03:14.825Z"}

{"thread":"main","class":"RsyncService","message":"Could not create directory '/home/sande/.ssh'.\r\n","level":"warn","timestamp":"2023-09-12T19:03:15.016Z"}

{"thread":"main","class":"RsyncService","message":"Failed to add the host to the list of known hosts (/cygdrive/c/Users/user1/.ssh/known_hosts).\r\n","level":"warn","timestamp":"2023-09-12T19:03:15.261Z"}

{"thread":"main","class":"RsyncService","message":"receiving file list ... ","level":"verbose","timestamp":"2023-09-12T19:03:21.875Z"}

{"thread":"main","class":"RsyncService","message":"done\n","level":"verbose","timestamp":"2023-09-12T19:03:21.936Z"}

{"thread":"main","class":"RsyncService","message":"_wpeprivate/\n","level":"verbose","timestamp":"2023-09-12T19:03:22.214Z"}

{"thread":"main","class":"RsyncService","message":"_wpeprivate/autoload.sql\n","level":"verbose","timestamp":"2023-09-12T19:03:22.214Z"}

{"thread":"main","service":{},"serviceBinVersion":{},"message":"Database responded to ping.","level":"debug","timestamp":"2023-09-12T19:04:39.885Z"}

{"thread":"main","class":"WpCliService","message":"This version of Xdebug does not support xdebug_info()","level":"info","timestamp":"2023-09-12T19:04:41.318Z"}

{"thread":"main","service":{},"serviceBinVersion":{},"message":"Database responded to ping.","level":"debug","timestamp":"2023-09-12T19:04:41.577Z"}

{"thread":"main","service":{},"serviceBinVersion":{},"message":"Database responded to ping.","level":"debug","timestamp":"2023-09-12T19:04:41.612Z"}

{"thread":"main","service":{},"serviceBinVersion":{},"message":"Database responded to ping.","level":"debug","timestamp":"2023-09-12T19:04:46.367Z"}

{"thread":"main","class":"WpCliService","message":"This version of Xdebug does not support xdebug_info()","level":"info","timestamp":"2023-09-12T19:04:47.931Z"}

{"thread":"main","service":{},"serviceBinVersion":{},"message":"Database responded to ping.","level":"debug","timestamp":"2023-09-12T19:04:48.080Z"}

{"thread":"main","service":{},"serviceBinVersion":{},"message":"Database responded to ping.","level":"debug","timestamp":"2023-09-12T19:04:48.086Z"}

{"thread":"main","service":{},"serviceBinVersion":{},"message":"Database responded to ping.","level":"debug","timestamp":"2023-09-12T19:04:55.267Z"}

{"thread":"main","class":"WpCliService","message":"This version of Xdebug does not support xdebug_info()","level":"info","timestamp":"2023-09-12T19:04:56.904Z"}

{"thread":"main","service":{},"serviceBinVersion":{},"message":"Database responded to ping.","level":"debug","timestamp":"2023-09-12T19:04:57.096Z"}

{"thread":"main","service":{},"serviceBinVersion":{},"message":"Database responded to ping.","level":"debug","timestamp":"2023-09-12T19:04:57.100Z"}


local-lightning.log

"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2023-09-12T18:42:37.052246Z 0 [System] [MY-010229] [Server] Starting crash recovery...","timestamp":"2023-09-12T18:42:38.178Z"}

{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2023-09-12T18:42:37.058265Z 0 [System] [MY-010232] [Server] Crash recovery finished.","timestamp":"2023-09-12T18:42:38.179Z"}

{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2023-09-12T18:42:38.141481Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.","timestamp":"2023-09-12T18:42:38.179Z"}

{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2023-09-12T18:42:38.178662Z 0 [System] [MY-010931] [Server] %%resourcesPath%%\\lightning-services\\mysql-8.0.16+6\\bin\\win64\\bin\\mysqld.exe: ready for connections. Version: '8.0.16' socket: '' port: 10005 MySQL Community Server - GPL.","timestamp":"2023-09-12T18:42:38.179Z"}

{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2023-09-12T18:47:49.991944Z 0 [System] [MY-010116] [Server] %%resourcesPath%%\\lightning-services\\mysql-8.0.16+6\\bin\\win64\\bin\\mysqld.exe (mysqld 8.0.16) starting as process 21624","timestamp":"2023-09-12T18:47:54.609Z"}

{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2023-09-12T18:47:49.993886Z 0 [Warning] [MY-013243] [Server] --character-set-server: The character set UTF8MB3 is deprecated and will be removed in a future release. Please consider using UTF8MB4 instead.","timestamp":"2023-09-12T18:47:54.609Z"}

{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2023-09-12T18:47:54.557435Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.","timestamp":"2023-09-12T18:47:54.610Z"}

{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2023-09-12T18:47:54.609723Z 0 [System] [MY-010931] [Server] %%resourcesPath%%\\lightning-services\\mysql-8.0.16+6\\bin\\win64\\bin\\mysqld.exe: ready for connections. Version: '8.0.16' socket: '' port: 10011 MySQL Community Server - GPL.","timestamp":"2023-09-12T18:47:54.611Z"}

{"thread":"main","class":"RsyncService","message":"Could not create directory '/home/user1/.ssh'.\r\n","level":"warn","timestamp":"2023-09-12T18:48:01.314Z"}

{"thread":"main","class":"RsyncService","message":"Failed to add the host to the list of known hosts (/cygdrive/c/Users/user1/.ssh/known_hosts).\r\n","level":"warn","timestamp":"2023-09-12T18:48:01.577Z"}

{"thread":"main","class":"SshService","message":"Could not create directory '/home/user1/.ssh'.\r\nWarning: Permanently added 'user1.ssh.wpengine.net,35.224.26.249' (RSA) to the list of known hosts.","level":"warn","timestamp":"2023-09-12T19:03:14.823Z"}

{"thread":"main","class":"RsyncService","message":"Could not create directory '/home/user1/.ssh'.\r\n","level":"warn","timestamp":"2023-09-12T19:03:15.016Z"}

{"thread":"main","class":"RsyncService","message":"Failed to add the host to the list of known hosts (/cygdrive/c/Users/user1/.ssh/known_hosts).\r\n","level":"warn","timestamp":"2023-09-12T19:03:15.261Z"}

router-logs/error.log:

2023/09/12 11:38:09 [alert] 2992#23412: OpenEvent("ngx_master_23136") failed (2: The system cannot find the file specified)

I can also post the zip file of all the logs if there is a secure way to do that without leaking sensitive information. Thank you for your help with this.

It’s definitely interesting that it’s only happening with that WP version but 6.3 has been out for a while and we haven’t come across any similar or widespread issues like this one.

If you create a new, blank site with 6.3 out of the gate do you still have trouble? Or is it just when you upgrade previous sites to WP 6.3?

For one of the sites having issues could you try something like this?

  • Export the site in Local to a zip, save it to your desktop
  • Completely delete the site from Local
  • Re-import the zip file into Local
  • Check if any errors or issues persist

Hi @Nick-B thank you for your recommendations. I tried creating a blank WP 6.3 site in local and it ran just fine, which does prove that the issue with Permissions Denied does seem to be specific to our site running 6.3 only.

1 Like

Did you try using the steps above to do a reimport and see if that resolves the issue?

I am having this same issue after a lot of troubleshooting. Please let me know if you find any solutions to this - continuing to work through other possible solutions in the meantime :confused:

Can you provide more details about what errors you’re getting and what you’ve tried for troubleshooting so far? Can you also share the below?

  • What is your OS?

  • What version of Local are you on?

  • Please attach a copy of your Local Logs

Hi @Nick-B,

For sure - thank you for helping!

Can you provide more details about what errors you’re getting and what you’ve tried for troubleshooting so far? Can you also share the below?

I’ve enabled Local to run through the firewall, I removed the read only attribute from step 1. Go to C:\Windows\System32\drivers\etc in the link above. I’ve uninstalled and reinstalled Local, I’ve deleted my sites and then reinstalled them to see if that may be it. I also have microsoft defender as anti-virus but not anything else. I saw Hosts file is detected as malware in Windows Defender - Microsoft Support and just put an exclusion in for C:\Windows\System32\drivers\etc\hosts on Microsoft Defender Antivirus scans but same issue.

I tried running the below:

<?php exec('whoami'); $execu = shell_exec('/usr/bin/whoami'); ?>

But both show as null or empty quotes “”

  • What is your OS? I’m on a g15 5520 dell ryzen, windows 11

  • What version of Local are you on? I’m running Local Version 7.2.1+6433

  • Please attach a copy of your Local Logs Attached! local-lightning.log (98.4 KB)

Error message: Failed to open stream: Permission denied inC:\Users\Melis\Local Sites\boat\app\public\wp-content\themes\BOAT-wordpress-theme\page-{annualReport}.php on line10

Fatal error

Let me know if you need any other pieces of info - more than happy to help in any way.

I just reinstalled Microsoft Visual C++ Redistributable for Visual Studio 2022 to see if that would resolve some of the errors but having the same issue still

You might need to go into the Local app folders and check for read/write permissions to narrow things down.

Alternatively you could Open Site Shell and reinstall the theme to see if works after the other changes you’ve made.

1 Like

@Nick-B that worked - thank you very much!!

1 Like

Glad to hear it @MMision! Happy Developing :slight_smile:

1 Like