Maintenance mode doesn't work anymore in .50.1
-
Hello,
after updating to .50.1 the maintenance mode is not working anymore. On my local wamp install I get the error message( ! ) Warning: require(C:\wamp\www\oekofaktumhttp://localhost/oekofaktum/_oeko_wp/bps-maintenance.php): failed to open stream: Invalid argument in C:\wamp\www\oekofaktum\index.php on line 20 Call Stack # Time Memory Function Location 1 0.0003 264856 {main}( ) ..\index.php:0 ( ! ) Fatal error: require(): Failed opening required 'C:\wamp\www\oekofaktumhttp://localhost/oekofaktum/_oeko_wp/bps-maintenance.php' (include_path='.;C:\php\pear') in C:\wamp\www\oekofaktum\index.php on line 20 Call Stack # Time Memory Function Location 1 0.0003 264856 {main}( ) ..\index.php:0
What’s wrong here?
Michael
-
require(C:\wamp\www\oekofaktumhttp://localhost/oekofaktum/_oeko_wp/bps-maintenance.php)
First try something simple: Resave your MMode options and generate/create new MMode template files. If the issue/problem is still occurring read on…
This is not a valid path above. You should not be seeing the folder path and URL path. I believe the only valid path would be this path for your WAMP site:
C:\wamp\www\oekofaktum/bps-maintenance.php
. Not exactly sure what would cause this on your particular WAMP setup/server. My best guess is this could be some sort of Symlink configuration issue/problem in one of your .conf files. If you made any changes to any of your .conf files then check them for configuration mistakes.There were no changes in MMode in .50.1 that had anything related to includes, requires or file paths so either something changed on your WAMP setup or the index.php MMode template file write did not happen correctly for whatever reason on your WAMP setup.
Changes to MMode in .50.1
Maintenance Mode Accordion: Maintenance Mode Accordion created for better functionality/usability (visual display only). Code correction (affects the Login link displayed only): Maintenance Mode website name not displayed in the reminder email. Code correction (affects the visual text area only): Maintenance Mode Apostrophes/single quote code character displayed with an escape backslash.index.php uses the __FILE__ Magic constant for the require path
if ( in_array( $_SERVER['REMOTE_ADDR'], $bps_maintenance_ip ) || in_array( $matches_three[0], $bps_maintenance_ip ) || in_array( $matches_two[0], $bps_maintenance_ip ) || in_array( $matches_one[0], $bps_maintenance_ip )) { require( dirname( __FILE__ ) . '/wp-blog-header.php' ); } else { require( dirname( __FILE__ ) . '/bps-maintenance.php' ); }
bps-maintenance.php uses the __FILE__ Magic constant for the include path
if ( file_exists( dirname( __FILE__ ) . '/bps-maintenance-values.php' ) ) { include( dirname( __FILE__ ) . '/bps-maintenance-values.php' ); }
Correction: the only valid path would be this path for your WAMP site:
C:\wamp\www\oekofaktum/bps-maintenance.php.
So it appears that something is definitely not correct in your configuration files if the URL path is being “spliced” into the folder path. Check your .conf and vhost configuration files.
And it appears that you are doing some sort of vhost thing since this portion of the URL shows a different structure than your folder path: /oekofaktum/_oeko_wp/
A basic XAMPP Virtual Host example in httpd-vhosts.conf. I assume WAMP is similar since this is basic/standard Apache conf stuff.
<VirtualHost example.local:80> ServerAdmin postmaster@localhost DocumentRoot "C:/xampp/htdocs/example" ServerName example.local ServerAlias example.local <Directory "C:/xampp/htdocs/example"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
Hi,
the problem not only occurred on the local wamp server but also online. However, online I was just getting a white page. I think I have disabled displaying errors somewhere.The maintenance page had been working a few days ago. The last updates I did in the last few days were “BPS” and two times “iThemes Security” (formerly Better WP Security, update 4.0.0 -> 4.0.2 -> 4.0.5). Then the maintenance page wasn’t working anymore. On the online site (which is running in maintenance mode and is not online so to say) I got the maintenance page running again by exchanging the database with a 2 day old backup version. This was before updating to 4.0.5. I also uploaded iThemes Security 4.0.2 again.
Then the maintenance page showed up again. I then updated everything again and now the maintenance page is working again. Strange!But on my local install the problem persists.
I have noticed that BPS writes into the index.php. I think this is where the problem is hidden.
My wordpress url is in a subfolder of my site url.
Therefor I have an index.php in the root directory and one in the folder of the wordpress install. BPS changes both files when turning maintenance mode on.
In the root index.php it writes the following:if ( in_array( $_SERVER['REMOTE_ADDR'], $bps_maintenance_ip ) || in_array( $matches_three[0], $bps_maintenance_ip ) || in_array( $matches_two[0], $bps_maintenance_ip ) || in_array( $matches_one[0], $bps_maintenance_ip )) { # BEGIN BPS MAINTENANCE MODE GWIOD require( dirname( __FILE__ ) . 'https://localhost/oekofaktum/_oeko_wp/wp-blog-header.php' ); } else { require( dirname( __FILE__ ) . 'https://localhost/oekofaktum/_oeko_wp/bps-maintenance.php' ); } # END BPS MAINTENANCE MODE GWIOD
Here it writes https://localhost/oekofaktum and this is where the wrong url is build.
In the index.php in the wordpress folder it doesn’t do that. It writes:if ( in_array( $_SERVER['REMOTE_ADDR'], $bps_maintenance_ip ) || in_array( $matches_three[0], $bps_maintenance_ip ) || in_array( $matches_two[0], $bps_maintenance_ip ) || in_array( $matches_one[0], $bps_maintenance_ip )) { require( dirname( __FILE__ ) . '/wp-blog-header.php' ); } else { require( dirname( __FILE__ ) . '/bps-maintenance.php' ); }
Is this a bug?
On my online installation this isn’t happening.
Michael
Reading your answers above again (some came while I was writing my reply) I guess you had come to the same conclusion already. I don’t understand the vhost stuff. I had never messed around with this. Don’t know if I’m running on vhost….
I searched for my httpd-vhosts.conf and found this dummy stuff:
<VirtualHost *:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot "c:/Apache24/docs/dummy-host.example.com" ServerName dummy-host.example.com ServerAlias www.dummy-host.example.com ErrorLog "logs/dummy-host.example.com-error.log" CustomLog "logs/dummy-host.example.com-access.log" common </VirtualHost>
So what does this tell me? Do I have to insert some reasonable stuff here?
Above you wrote that among the changes to .50.1 was
index.php uses the __FILE__ Magic constant for the require path
So that’s the reason I’m seeing this problem now, is it?
Michael
.50 Bugfix/Code Correction: Maintenance Mode str_replace has been changed to dirname for GWIOD site types to get the site root index.php file path
In .50 a change/code correction was made to get the correct site path for the GWIOD root site index.php file, but after checking the code again it looks like one of the variable names was not changed to the new variable name. I will need to double check this, do some testing and confirm that this is the problem even though it looks like problem. I will post the code modification that needs to be done after testing confirmation and we will release a new BPS version with that change made permanently.
Actually the code is ok for GWIOD sites. I was looking at the wrong thing.
So what needs to be looked at on the site that is having problems is this:
For Single/Standard WordPress GWIOD sites the
$gwiod_url
variable gets the folder name fromget_option('home');
andget_option('siteurl');
and doing a string replace which would leave only the folder name for the value of the$gwiod_url
variable. Logically that means your WordPress Settings for URL’s may be incorrect/unusual/non-standard.Go to your WordPress Settings >>> General page and post your…
WordPress Address (URL)
…and…
Site Address (URL)$publicly_displayed_url = get_option('home'); $actual_wp_install_url = get_option('siteurl'); ... ... ... $gwiod_url = str_replace( $publicly_displayed_url, "", $actual_wp_install_url ); ... ... ... $gwiod_stringReplace = preg_replace('/#\sBEGIN\sBPS\sMAINTENANCE\sMODE\sGWIOD\s*require(.*)\s*\}(.*)\s*require(.*)\s*\}\s*#\sEND\sBPS\sMAINTENANCE\sMODE\sGWIOD/', "# BEGIN BPS MAINTENANCE MODE GWIOD\nrequire( dirname( __FILE__ ) . '".$gwiod_url."/wp-blog-header.php' );\n} else {\nrequire( dirname( __FILE__ ) . '".$gwiod_url."/bps-maintenance.php' );\n}\n# END BPS MAINTENANCE MODE GWIOD", $gwiod_stringReplace);
or for some strange reason the string replace is not stripping out the URL:
https://localhost/oekofaktum
The code should look like this for the site root index.php file. The URL should be stripped out of the require and only the folder name/path should be in the URL/code.
if ( in_array( $_SERVER['REMOTE_ADDR'], $bps_maintenance_ip ) || in_array( $matches_three[0], $bps_maintenance_ip ) || in_array( $matches_two[0], $bps_maintenance_ip ) || in_array( $matches_one[0], $bps_maintenance_ip )) { # BEGIN BPS MAINTENANCE MODE GWIOD require( dirname( __FILE__ ) . '/_oeko_wp/wp-blog-header.php' ); } else { require( dirname( __FILE__ ) . '/_oeko_wp/bps-maintenance.php' ); } # END BPS MAINTENANCE MODE GWIOD
It’s something like this
WordPress Address (URL). http://www.sitename.de/wordpress
…and…
Site Address (URL). http://www.sitename.deThe format looks correct so something else is causing the problem on your local WAMP installation. str_replace is a simple PHP function that should work on every type of site so the problem is probably not with that function itself. I guess you are back to looking at your Server configuration files or something going on in your database. If it was me I would install another local test site and only install BPS and see what happens to determine if it is a site specific problem or a Server configuration problem.
Oh and I have had problems with Xdebug by itself causing wierd things to happen so turn that off first to eliminate Xdebug itself.
It is really strange. I have different sites and they are all on a localhost as well as online. The problem can occur on either installations online or local and seems to vanish or appear out of nowhere.
The local site, where the problem occurred first is now behaving correctly. I have just migrated this local site to the online site and now the problem occurrs on the online site. And the path is only incorrect in the index.php of the root directory of my GWIOD installation.Sounds like a caching problem or maybe some kind of Database issue/problem.
I guess it could be something in your Browser too. Some sort of Add-on or extension?
- The topic ‘Maintenance mode doesn't work anymore in .50.1’ is closed to new replies.