Maintenance Mode – Network/Multisite parse error: syntax error unexpected = expecting T_VARIABLE or $ in index.php on line 37

Home Forums BulletProof Security Pro Maintenance Mode – Network/Multisite parse error: syntax error unexpected = expecting T_VARIABLE or $ in index.php on line 37

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #17161
    Max
    Participant

    Hi AITpro,

    I am having an issue with the Maintenance Mode wherein everything looks fine setup-wise, but upon activation of frontend MM the sites break and display an error message publicly that shows my server file path. Further, when I turn MM off, the frontend continues to be broken.

    I first tried to use MM on one of my subsites. I read the instruction carefully. I whitelisted my IP just in case. I did NOT check backend MM. (The backend continues to be accessible.)

    I was unable to fix this subsite after the failed MM condition was not affected by turning MM off via the BPS UI panel, and so went on to test on the primary site in case there was some setting that needed to be established there prior to using MM on subsites, and also just to test  again.

    I read the instructions again, double checked my settings. I set for all subsites and primary. The preview looked fine. Upon activating frontend MM I observed the same behavior as my prior test. I was again unable to remedy the behavior by turning MM off.

    Perhaps it is also worth noting that I am using WPMUDev’s Domain Mapping plugin and that the error message appears the same on my primary and subdomains/mapped domains. Below is an example of the error message:

    Parse error: syntax error, unexpected '=', expecting T_VARIABLE or '$' in /home/xxx/public_html/index.php on line 37

    Since the error message is currently displaying sensitive info openly, I plan to scrub this WP and install fresh to retest. I will of course update if I can reproduce on my fresh install.

    Kind Regards,
    Max

    ps. I had earlier put my present install through the ringer so to speak in testing… I could easily see having left some code messes around 🙂

    #17168
    AITpro Admin
    Keymaster

    Unfortunately, BPS Maintenance Mode does not work on Network/Multisite subdomain site types.  We will be adding additional error/conditional checking code and displayed messages in BPS for this in the next version release.

    If someone has a Network/Multisite subdomain site type then Maintenance Mode will be disabled/prevented from doing anything on that site type and display a message something like:  BPS Maintenance Mode does work correctly on Network/Multisite subdomain site types.  Since your website is a Network/Multisite subdomain site type all BPS Maintenance Mode features are disabled by default.  Please find an alternative Maintenance Mode plugin to use instead for maintenance mode.

    You do not need to scrub/delete this site just because that particular error message was displayed.  If someone malicious wants to get the path to your hosting account that is a very simple to do.  You obviously do not want to make it easy for hackers, but any hacker can get your hosting account path any time they want to get that information.  Yes, it is considered sensitive information, but No it is not considered a “game ender” if your hosting account path is found/known.

    Since you have BPS Pro you will need to do these steps so that AutoRestore does not quarantine the new index.php file that you upload to your website:
    1. Download WordPress from here:  http://wordpress.org/download/
    2. Unzip the wordpress.zip file on your computer.
    3. Go to the BPS Pro AutoRestore page and turn off AutoRestore.
    4. Upload a new WordPress root index.php file to your website file from the unzipped WordPress folder/files on your computer.  The correct root index.php file is the index.php file that is in the same folder/folder path as the wp-config-sample.php file.
    5. Go back to the BPS Pro AutoRestore page and click the Root Files >>> Backup Files button.
    6. Turn AutoRestore back On.

    #17180
    AITpro Admin
    Keymaster

    Actually what we have decided to do is add a conditional check for the BPS/BPS Pro menus.  If a website is a Network/Multisite subdomain site type then the Maintenance Mode menu link will not be displayed under BPS/BPS Pro menus for the Primary Network/Multisite subdomain site and all subdomain subsites.

    #17182
    AITpro Admin
    Keymaster

    Very IMPORTANT!  We just found a coding mistake in the BPS and BPS Pro Network/Multisite subdomain .htaccess writing code.  We will be releasing a new BPS Pro version within 1-2 days to correct this.

    Impact: Network/Multisite subdomain .htaccess code/websites.

    Either we screwed up originally and misinterpreted the WordPress Network/Multisite subdomain writing .htaccess code in /wp-admin/network.php or something changed since we originally created that code and we screwed up by not changing the Network/Multisite writing code in BPS. Either way we screwed up.

    We are fixing the Network/Multisite subdomain .htaccess writing code right now in BPS Pro 9.3 and will have the new version of BPS Pro 9.3 released ASAP.

    Workaround until a new version of BPS Pro is released:
    1. Go the Network Admin Panel/Dashboard.
    2. Click on Settings >>> Network Setup
    3. Copy the .htaccess code that you see under “2. Add the following to your .htaccess file in…” to a Notepad or Notepad++ text file on your computer (do NOT use Word or WordPad).
    4. Go to your Primary site Dashboard.
    5. Go to the BPS Pro B-Core >>> htaccess File Editor tab page and unlock your root htaccess file if it is currently locked.
    6. Click on the “Your Current Root htaccess File” tab and scroll down in the contents of your root .htaccess file until you see this htaccess code/text: # WP REWRITE LOOP START

    Replace the .htaccess code that looks similar to this code below with the similar code you copied to the Notepad text file on your computer:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

    7. Scroll down further in the root .htaccess file contents until you come to code that looks similar to this code below. Replace the .htaccess code that looks similar to this code below with the similar code you copied to the Notepad text file on your computer:

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
    RewriteRule ^(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

    8. Click the Update File button to save your changes/edits.
    9. Make a backup of your root .htaccess file.

    #17192
    Max
    Participant

    Hi Keymaster,

    1) Unfortunately, BPS Maintenance Mode does not work on Network/Multisite subdomain site types.  We will be adding additional error/conditional checking code and displayed messages in BPS for this in the next version release.

    Well, that more or less explains that! 🙂

    2) Actually what we have decided to do is add a conditional check…
    This seems effective.

    3) Network/Multisite subdomain .htaccess & BPSpro 9.3
    I’ve got respect for those who own their issues. Thanks for clearly calling this out along with a temp workaround. Legit.

    4) Please find an alternative Maintenance Mode plugin to use instead for maintenance mode.
    I like to use SeedProd’s Coming Soon Pro plugin for single sites, I know it works within a multisite, but don’t know that it handles a network wide maintenance mode. I will look around any suggestions?

    5) Generally, just thank you. I really appreciate both your expertise and your effort.

    Best Regards, Max

    #17196
    AITpro Admin
    Keymaster

    3. Yep, we know that we are human, no one is perfect and being humans we will occaisonally make mistakes (hopefully very minor ones).  It has been a couple of years since we have made any major boo boos, which are a very painful thing / hard lesson to learn, so we test, retest and test again before releasing BPS / BPS Pro versions.

    4.  I was hoping you would not ask that question.  ha ha ha.  There are a ton of Maintenance Mode plugins as I am sure you already aware of.  I have never actually used any other Maintenance Mode plugins so I don’t have any personal experience using any of them.  Like all other plugin choices you want to do your homework by looking in that plugin’s support forum.  Check what kinds of problems folks are having and are they getting solutions or is the plugin author not responding to questions.  And of course you want to double check that the Maintenance Mode plugin you choose works with Network/Multisite Subdomain site types.  Hands down Network/Multisite Subdomain sites are the most complex WordPress site types. 😉

    At some point we will get the Network/Multisite Subdomain Maintenance Mode figured out.  We actually had this working in older versions of BPS using an htaccess redirect to the maintenance mode template file so we can probably do something very similar again for Subdomain sites so that that WYSIWG editor can still be used to create the maintenance mode template file, but instead of loading template file directly the older htaccess redirect method can be used again.  We will see if we can get this into BPS Pro 9.4 (not 9.3).

    #17200
    Max
    Participant

    1) Humans are humans, and testing is good that seems to hold true 😉
    2) Plugins are personal choices, you’re right. I’ll look around.

    3) I have gotten the idea that subdomain multisites create extra complexity. I am not a fan of extraneous complexity.
    3a) My aim is a closed network for managing my own and some client sites.
    I plan to use HTTPS for my admin areas and for select pages (eg. on-site checkouts).
    I plan to use Domain Mapping to map TLDs to subsites generally this means running only with HTTP for mapped domains (outside of CloudFlare, UCCs or SNI), so…
    I plan to pass login and admin to HTTPS secured original subsite addresses and to work towards an ecommerce system wherein checkouts will occur at the HTTPS original addresses as well.

    To wit:
    I can’t get my self past the idea that subdomains will be more psychologically clear and reassuring during the redirect process for checkout pages (or user login for that matter).

    The reason I’ve kinda asked you to read all that is: I suspect that whether I am correct in my psych101 above or not, that the technical complexities I am introducing are well beyond my capacity to appreciate. I am beginning to suspect that I should seriously reconsider. I know that I can’t ask you to approve/disapprove of or assess my use case, yet I am hoping for an expert opinion to help me inform my own. Any input appreciated.

    I also appreciate that you’re busy and that this is rather outside of scope; no worries if you pass.

    Best Regards, max

    #17202
    AITpro Admin
    Keymaster

    We almost chose a Network/Multisite WordPress installation for all of our sites, but decided against it to spread the resource load around.  The most resource draining thing about WordPress sites are database queries.  You can setup separate databases for Network/Multisite sites so that subsites use separate databases, but we decided not to go that route and just chose to install separate WordPress installations for all of our sites.

    Some of our websites connect to other site’s databases using simple php mysql query connect code to update those other databases, which is very  easy to do/create, assuming you have an average grasp of writing basic simple code.

    Ok so since you have a Network/Multisite site then all of your sites will be sharing one database, unless of course you choose to create additional separate databases for subsites.  This does make updating that single database visually and technically easier if you do not have an average grasp of writing basic simple code.  I have no idea how difficult it is to setup a Live / Production hosted Network/Multisite Subdomain site, since I do not have any personal experience with setting one up in a Live / Production hosted site.  I have setup testing / Development Subdomain sites, but that is of course a completely different animal.

    So my honest opinion is that it is going to be somewhat difficult and challenging to get a Network/Multisite Subdomain setup.  After that I think everything else will not be that much of a challenge or be that difficult.  If you are expecting a decent amount of visitor traffic per month – 30,000 to 100,000 – visitors per month then you may want to factor in that a single database trying to handle that amount of visitor traffic is going to have problems so you should instead choose to either create separate databases for subsites or choose to install completely separate websites.  Just because websites are not physically installed on the same Network/Multisite installation does NOT mean that the separate sites would not be able to access each other’s databases.

    #17204
    Max
    Participant

    Wow! Thank you.

    That was way more insight than I had even hoped for. you raise excellent points, some of which I have considered already. I will think on this.

    One follow up: any opinions about WPMUDev’s Multi-DB plugin as a database solution (256 dbs)? It seems to me that with this setup (similar to Hyper-DB) I can move dbs to seperate servers if needed. I have gotten this working before in testing, never tried in production.

    Thanks for your perspicacity 🙂
    Regards, Max

    #17208
    AITpro Admin
    Keymaster

    This is the first I have heard about WPMUDev’s Multi-DB plugin so you already know more than I would about that plugin.  So nope no opinion since I do not know what that plugin is or does.

    #17209
    Max
    Participant

    Cheers 🙂

    https://premium.wpmudev.org/project/multi-db/
    from Multi-DB link: “It’s the same solution we use on Edublogs.org and is very similar to that used on WordPress.com.”

    https://wordpress.org/plugins/hyperdb/
    from the HyperDB link: “It is based on the code currently used in production on WordPress.com with many MySQL servers spanning multiple datacenters.”

    https://wordpress.org/plugins/shardb/
    from the SharDB link: “This plugin is based on HyperDB which is the database plugin used by WordPress.com. Like HyperDB, this plugin autodetects whether a query is requesting a global or blog table.”

    Its my understanding that WPMUDev has also based their Multi-DB on HyperDB and also autodetects whether a query is requesting a global or blog table.

    Regards & Aloha, Max

    #17284
    Max
    Participant

    Howdy! Just wanted to check in regarding the 9.3 release?
    No worries if it’ll be a bit… WP4 is right around the corner too yeah?
    I decided to wait until you release 9.3 (and maybe even until the whole WP4 thing happens) before diving in in ernest again.

    Best Regards, Max

    #17285
    AITpro Admin
    Keymaster

    WP 4.0 got pushed back to next week.  The tentative release date was Aug. 27.  We also pushed BPS Pro 9.3 back a bit to take care of a couple of other things.  BPS Pro 9.3 will be released between Sept. 1-3.

    As it turns out Maintenance Mode does partially work on a Network/Multisite Subdomain site.  The Primary site can be successfully put into MMode, but there are some undesirable issues/problems with doing that – it does not work 100% as intended.  ie the entire site is put into MMode – all sites  instead of individual sites.  MMode on Subsites does not work at all due to using the path object value:  $current_blog->path; for creating the template file name for Subdomain subsites instead of the domain object value:  $current_blog->domain;.  What we are going to do is in BPS Pro 9.3 we are going to hide the MMode menus for subsites and then in BPS Pro 9.4 we will have all the code completed and working for all Subdomain Primary and Subsite sites.

    #19297
    Max
    Participant

    Hi AITpro,

    Can you address if BPSpro 9.8 has included the functionality “BPS Pro 9.4 we will have all the code completed and working for all Subdomain Primary and Subsite sites.” which you mentioned above in last post.

    I checked http://forum.ait-pro.com/forums/topic/network-multisite-read-me-first/ but documentation seems not have changed re. Maintenance Mode since 9.0?

    Edit: Also, regarding above comment “instead choose to either create separate databases for subsites or choose to install completely separate websites.  Just because websites are not physically installed on the same Network/Multisite installation does NOT mean that the separate sites would not be able to access each other’s databases.”

    I am considering the use of WPMUDevs’s MultiDB solution to manage the above. My idea is to set the primary site table prefix to wp_1_ which will allow MutliDB to use ‘VIP Database’ feature to set primary site to use a single database; subsites will also use single, separate databases via ‘VIP Database’ functionality (named for VIP service from WordPress.com wherein subsite’s are assigned separate databases).

    This will allow us to move the databases to backend servers as needed. This seems clearer to me than using the database ‘sharding’ features of MultiDB (and similar like Automattic’s HyperDB or ShardDB) though this is likely because I am no db admin.

    Again, in my idea, the primary and all subsites would be using different databases.

    Do you have a few thoughts on how to set BPSpro to be aware of and work with these databases?

    Cheers,
    Max

    #19299
    AITpro Admin
    Keymaster

    Adding the additional coding work required for Network/Multisite subdomain sites keeps getting pushed back due to having a lower priority and due to the complexities and variations of possible Network/Multisite subdomain site types.  Network/Multisite subdomain site types are the most complex type of WordPress installation.  We hope to get to that new code in BPS Pro 9.9.  If not, then we will shoot for BPS Pro 10.0.

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.