David Schieber's picture

I have a Turnkey WordPress 14.1 appliance with Divi Theme, http://www.elegantthemes.com/gallery/divi/. It was installed by a developer on his own Wordpress deployment where it works fine. After it's migrated to my Turnkey appliance a feature of the Divi Theme, Divi Builder, fails to load when opening a page to edit it.

Divi Builder Timeout

Reloading produces the same error. Disabling Plugins is not an option and besides it worked fine on the developers WordPress deployment.

The developer found this thread in the Divi Theme forum:

I had the same issue with a turnkey linux Wordpress 14.0 and 14.1

the apache error log showed: AH01328: Line too long
It seemed the /etc/apache2/mod-enabled/substitute.conf file included specific turnkey linux configuartion data. This conflicted with the divi builder. After cleaning 'substiture.conf' the divi builder is working again.

# Support TurnKey Linux by adding credit to footer
<Location "/">
#remove the turnkey linux configuration
AddOutputFilterByType SUBSTITUTE text/html
Substitute s/foo/bar/ni
</Location>

I'm not exactly sure what to do with this advice.

Has anyone seen this issue and resolved it, or can help me interpret and follow the suggestion made in the Divi forum?

Thanks!

Forum: 
David Schieber's picture

I found the file referred to in the Divi forum and modified it to this:

# Support TurnKey Linux by adding credit to footer
<Location />
    AddOutputFilterByType SUBSTITUTE text/html
</Location>

The original looked like this:

# Support TurnKey Linux by adding credit to footer
<Location />
    AddOutputFilterByType INFLATE;SUBSTITUTE;DEFLATE text/html
    Substitute "s|</head>|<style type='text/css'> #turnkey-credit { font-family: Tahoma,Sans,Arial,Helvetica,Verdana,sans-serif; font-size: 11px; text-align: center; } #turnkey-credit a { text-decoration: none; } #turnkey-credit a:hover { text-decoration: underline; } body.wp-admin #turnkey-credit, body#image #turnkey-credit, body#media-upload #turnkey-credit { display: none; } </style></head>|i"
    Substitute "s|</body>|<div id='turnkey-credit'> <div style='clear: both;'> <a href='https://www.turnkeylinux.org/wordpress'>WordPress Appliance</a> - Powered by <a href='https://www.turnkeylinux.org'>TurnKey Linux</a> </div> </div></body>|i"
</Location>

The modification appeared to only make a single change which was to remove the Turnkey Linux WordPress footer credit at the bottom of the WordPress Admin logon page. I can't find any other change. I don't know if that breaks any agreement I have with Turnkey Linux to display credit information.

Anyway problem solved. If anyone knows if I'm breaking any copywrite or crediting rules, please let me know and I'll look for another solution.

David Schieber's picture

Oddly, I'm getting the same error again. Any ideas?

Brent Quick's picture

I had developer and support from ElegantBuilder both on my ass about this issue and was able to solve it by disabling the substitute module on the global Apache server settings.  Have not seen any side efects since but don't do much beside insure site is up.

Jeremy Davis's picture

We'd rather you kept the TurnKey credit footer there, but obviously TurnKey isn't much value to you if it breaks completely with your site how you want it. If it's breaking things then you need to disable it. No hard feelings at all. Although if you'd love to help spread the word in other ways that's always appreciated! :)

I'm assuming that the theme must be using some Apache substitution or similar somewhere and combined together they are breaching the 1MB Apache 2.4 limit.

Brent Quick's picture

I was able to identify the problem, though unfortunately I was not able to resolve it. The issue is that the builder's requests exceed the max line length imposed by Apache ModSubstitute as indicated by the following error:

 

[Wed May 04 23:59:31.340064 2016] [substitute:error] [pid 9907] [client 108.76.136.227:56370] AH01328: Line too long, URI /wp-admin/admin-ajax.php, referer: http://www.site.com/wp-admin/post-new.php?post_type=page

 

The solution is to increase the max line length by adding the following to your .htaccess file:

<IfModule mod_substitute.c>
SubstituteMaxLineLength 10M
</IfModule>

 

However, it appears that the version of Apache you have installed contains a bug where it does not recognize the "SubstituteMaxLineLength" directive. To resolve the issue you need to install a newer version of Apache. I recommend contacting whoever is managing your server to provide them with these details. They should be able to resolve the issue. 
 

Jeremy Davis's picture

It's just that the "SubstituteMaxLineLength" directive wasn't introduced until a later version of Apache (IIRC it was introduced in v2.4.11). We use the version of Apache from the Debian repos (so that it can get auto security updates) but it's only v2.4.10.

So the best workaround at this point is to disable the TurnKey credit. Another option could be to install Apache from the testing repo (it's got v2.4.20) but I wouldn't recommend using that for production as it won't get auto security updates and being testing, things are likely to change...

Jeremy Davis's picture

TBH Joe, I'm not even 100% sure that our appliance has one (but I could be wrong). FWIW, .htaccess files aren't required when you have full access to the Apache config, as you can just include the .htaccess config within the main Apache site config. Also they aren't supported by other webservers (such as Nginx) so have limited value in some scenarios.

Regardless, I suggest that you do a search, then you'll know for sure. So from the commandline, run this:

find /var/www -type f -name '.htaccess'
If there are any .htaccess files, that will find them!

Otherwise, you'll need to edit the default Apache Wordpress site file directly. It should be /etc/apache2/sites-available/wordpress.conf if you want to edit it by hand from the commandline. Personally, that's my preference, but Webmin is another option.

Brent Quick's picture

@Joe Sko - Are you trying to SSH to it or us the Web Admin interface?  I am not somewhere I can check the first but the second is webmin so here is the Wiki link ->  https://doxfer.webmin.com/Webmin/Apache_Webserver#Editing_.htaccess_files

Add new comment