Opened 10 years ago
Closed 5 years ago
#28246 closed defect (bug) (invalid)
Permalink Options page throws errors on Windows IIS
Reported by: | pkmnfrk | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.9.1 |
Component: | Permalinks | Keywords: | reporter-feedback |
Focuses: | administration | Cc: |
Description
Note: My installation on my dev machine is at c:\www\krystal\wordpress (as a subdirectory).
Upon visiting the permalink settings page (), an error is visible at the top of the page:
Warning: DOMDocument::load(): I/O warning : failed to load external entity "c://www//krystal/web.config" in C:\www\krystal\wordpress\wp-admin\includes\misc.php on line 517
Saving the settings fails with the same error, and does not actually update the web.config as expected.
I chased this bug all the way to the wp-admin/includes/file.php:get_home_path
function which seems to assume that magic quotes have not been applied to $_SERVER
variables. See #18322 for more details on this issue.
Anyway, the fix is pretty simple. There are two references to $_SERVER['SCRIPT_FILENAME']
. These should be wrapped in stripslashes
.
With the fix in place, the permalink options page functions correctly (no errors, and web.config is updated as expected).
I suspect this might fix other places that call win_is_writable as well, but I haven't noticed anything else.
BEFORE:
$pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), trailingslashit( $wp_path_rel_to_home ) ); $home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos );
AFTER:
$pos = strripos( str_replace( '\\', '/', stripslashes( $_SERVER['SCRIPT_FILENAME'] ) ), trailingslashit( $wp_path_rel_to_home ) ); $home_path = substr( stripslashes( $_SERVER['SCRIPT_FILENAME'] ), 0, $pos );
Change History (7)
This ticket was mentioned in Slack in #core by jorbin. View the logs.
9 years ago
#2
@
9 years ago
- Summary changed from Permalink Options page throws errors on Windows to Permalink Options page throws errors on Windows IIS
#3
@
9 years ago
Microsoft-IIS/8.5
Windows NT NT10-STL 6.2 build 9200 (Unknow Windows version Datacenter Edition) i586
Intel64 Family 6 Model 44 Stepping 2, GenuineIntel
Above taken from phpinfo()
.
Running WordPress 4.2.2.
I had this same error, I applied the mentioned stripslashes()
fix and resolved the error. I also rolled the change back then retested, still got the same error.
Warning: DOMDocument::load(): I/O warning : failed to load external entity "D://home//domain//subroot//ray/web.config" in D:\home\domain\subroot\ray\wp\wp-admin\includes\misc.php on line 519
Reapplied stripslashes()
fix and set the permalink option "Month and name" and all is working fine.
One additional note, WordPress did not create the web.config
for me, may just be a permission thing. After some Googling I manually created the following:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.web> <customErrors mode="Off"/> </system.web> <system.webServer> <rewrite> <rules> <rule name="wordpress" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
My web.config
accuracy aside and stripslashes()
in place, this seems to be working fine for me now.
#4
@
9 years ago
On IIS 8.0 and 8.5, with a fresh installed WordPress 4.2.2, I'm unable to reproduce this error. My PHP error log stays empty, and no error message is displayed on /wp-admin/options-permalink.php
.
At first glance, it must be a permission error on the web.config file. Even if I remove my web.config file, it's recreated. Removing all file permissions results in an IIS error, and removing the write/modify permission set results in a message after updating the Permalinks:
You should update your web.config now.
@pkmnfrk was the web.config file created during the WordPress installation? As @rmcneill said it didn't, that's probably due to file permissions on the WordPress directory and files, or application pool settings.
I've put the provided code
$pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), trailingslashit( $wp_path_rel_to_home ) ); $home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos );
into a shortcode for quick testing, and it prints the correct home path: d:\\www\\phpng.vevida-test.nl\www\
in my test environment. Even with 4.3-beta2-33249.
@pkmnfrk can you provide some more details on your IIS setup? Application pool settings such as authentication, in correlation with directory and file permissons? What are your $home
and $siteurl
settings (Dashboard > General).
Are you testing with multiple test websites and/or requests (refreshes) on the same website? If so, then this maybe a related issue: https://bugs.php.net/bug.php?id=64938 (libxml_disable_entity_loader setting is shared between threads), found through http://stackoverflow.com/a/24190224 and https://pyd.io/f/topic/failed-to-load-external-entity-boot-confmanifest-xml/page/3/#post-72211.
Someone who can reproduce the DOMDocument::load() warning should probably investigate this further , unfortunately I can't.
Someone that has Windows and IIS is going to need to confirm if this is still an issue. I am not that person.