#29 – Fatal Error Installation

Posted in ‘weeblrAMP’
This is a public ticket. Everybody will be able to see its contents. Only enter usernames, passwords or any other sensitive information in the Private information field.
Friday, 28 April 2017 11:02 UTC
hidohebhi
I've tried installing, deleting, and re-installing the plugin a few times, but I can never activate it. Always get a fatal error:

Warning: copy(.../mu-plugins/weeblramp_plugins_handler.php): failed to open stream: Permission denied in .../plugins/weeblramp/helper/boot.php on line 678 Fatal error: Arrays are not allowed in class constants in .../plugins/weeblramp/vendor/weeblr/wblib/packages/system/log.php on line 40 

(I shortened the URL paths above when pasting the error here.)

I don't know if this is because the PHP version on our server is older? (We're about to move hosts, so if that's the case, then it will fix itself.)
Friday, 28 April 2017 11:08 UTC
wb_weeblrpress
Hi

The first message says that PHP does not have permissions to write to the /mu-plugins folder, which is required during the activation procedure. That should prevent some operation of weeblrAMP, but not all.

Can you look at that server side, why PHP cannot write to that folder?

The PHP version seems involved in the second message. Obviously though, there should not be a fatal error. Can you tell me what the PHP version is?

We check for PHP version upon activation, so it should stop the activation procedure if PHP is not OK. Maybe we are still trying to log that informatio though, which seems to be causing the fatal error during the logging action.

Looking into it, I'll get back to you soon.

Rgds
 
Friday, 28 April 2017 11:42 UTC
hidohebhi
So I used FTP to change the permissions of that folder and then tried to activate the plugin.
This time, it didn’t give me the error, but it crashed our site.  (Which was fixed as soon as I removed the plugin through FTP).  I tried a second time with the same result.
gFoulvEcRzCPUSitmZPs_Jeremy%20Hendon.png#logoJeremy Hendon
Live the Good Lifem:646.206.5553 | e:jeremy@jeremyhendon.com | w:http://jeremyhendon.comfacebook.png snapchat.png linkedin.png twitter.png instagram.png


On Apr 28, 2017, at 12:08 PM, WeeblrPress <weeblramp-ticket-reply@weeblrpress.com> wrote:
[WeeblrPress] Reply to your public ticket #29 Fatal Error Installation [weeblrAMP]

Friday, 28 April 2017 11:47 UTC
wb_weeblrpress
Hi

Sorry about all that. The problem is indeed the PHP version I'm sure, I found out that we use some instructions in one part of the plugin that require a higher PHP version that what you most likely have.

I have made a new development version that you can download from the development versions download area. You will have to manually install it over the existing one though.

Please let me know how it goes.

Rgds
 
Friday, 28 April 2017 12:00 UTC
hidohebhi
No problem.  Thanks so much for the super-quick replies.  We’re moving to a new host today or tomorrow, so that should take care of the PHP issue.
gFoulvEcRzCPUSitmZPs_Jeremy%20Hendon.png#logoJeremy Hendon
Live the Good Lifem:646.206.5553 | e:jeremy@jeremyhendon.com | w:http://jeremyhendon.comfacebook.png snapchat.png linkedin.png twitter.png instagram.png


On Apr 28, 2017, at 12:47 PM, WeeblrPress <weeblramp-ticket-reply@weeblrpress.com> wrote:
[WeeblrPress] Reply to your public ticket #29 Fatal Error Installation [weeblrAMP]

Friday, 28 April 2017 13:12 UTC
wb_weeblrpress
Hi

If you can just spare a bit more time, can you tell me what's you current PHP version?


Rgds

 
Friday, 28 April 2017 13:18 UTC
hidohebhi
Sure - I’ve asked, as I don’t know at the moment.  We’re currently on a managed platform with limited access to the server, so I need them to tell me.  But I’ll let you know when they get back to me.
gFoulvEcRzCPUSitmZPs_Jeremy%20Hendon.png#logoJeremy Hendon
Live the Good Lifem:646.206.5553 | e:jeremy@jeremyhendon.com | w:http://jeremyhendon.comfacebook.png snapchat.png linkedin.png twitter.png instagram.png


On Apr 28, 2017, at 2:12 PM, WeeblrPress <weeblramp-ticket-reply@weeblrpress.com> wrote:
[WeeblrPress] Reply to your public ticket #29 Fatal Error Installation [weeblrAMP]

Friday, 28 April 2017 13:22 UTC
wb_weeblrpress

OK great and many thanks!

 
Friday, 28 April 2017 13:24 UTC
hidohebhi
Quick question for you.  Is it possible with WeeblrPress to place a fixed-position notification bar at the bottom of AMP pages?  Our primary desire is to be able to still collect leads.  We’ll forgo popups, slide-ins, etc., but it would be nice to have the fixed bar for lead capture.  (Regardless of whether it leads to a lightbox or separate opt-in page.)
I know that the AMP for WP plugin has an extension that does this.  I’d prefer to use WeeblrPress for various reasons - mostly that I don’t want to rely on the Automattic plugin that seems to be pretty much abandoned now.

gFoulvEcRzCPUSitmZPs_Jeremy%20Hendon.png#logoJeremy Hendon
Live the Good Lifem:646.206.5553 | e:jeremy@jeremyhendon.com | w:http://jeremyhendon.comfacebook.png snapchat.png linkedin.png twitter.png instagram.png


On Apr 28, 2017, at 2:12 PM, WeeblrPress <weeblramp-ticket-reply@weeblrpress.com> wrote:
[WeeblrPress] Reply to your public ticket #29 Fatal Error Installation [weeblrAMP]

Friday, 28 April 2017 14:17 UTC
wb_weeblrpress
Hi

About leads collection, I can think of using a CF7 of GravityForms form. Sticking the shortcode for it in the "AMP: After content" widget will let you collect leads as you usually do.
Making it a fixed position will require a bit of CSS (there is a Custom CSS input field for that in settings), but it should be doable. I have done a quick proof of concept, and this CSS sticks the form at the bottom:
.weeblramp_after_content{
position: fixed;
bottom: 0;
background: #6E97CC;
width: 100%;
max-width: 36rem;
box-sizing: border-box;
}
.wbamp-wrapper-content {padding-bottom: 20em}

Obviously you'd need to adjust that your site, but that should not be too much to handle.

Note you cannot use an AMP notification for that, as those are not WordPress content, and shortcodes are not executed in them at all. Only AMP-compatible content is allowed.

Just to let you know, we are finishing off the PolyLang integration (you have it in the dev version). It's only for posts, pages, etc not WooCommerce at the moment.
Once this is done, our next feature is to add a fixed bar at the bottom of the page. It will be available as a way to insert sharing buttons, so it is really meant to have a low-height, not to use up too much space vertically. Inserting a form there may take up too much space, but it's a good idea, so I might create it rather as an additional widget position, so that content can be more easily inserted.

Rgds
 
Friday, 28 April 2017 18:18 UTC
hidohebhi
Just to update you - the PHP version was 5.5 on the server where it was giving me those errors.
gFoulvEcRzCPUSitmZPs_Jeremy%20Hendon.png#logoJeremy Hendon
Live the Good Lifem:646.206.5553 | e:jeremy@jeremyhendon.com | w:http://jeremyhendon.comfacebook.png snapchat.png linkedin.png twitter.png instagram.png


On Apr 28, 2017, at 3:17 PM, WeeblrPress <weeblramp-ticket-reply@weeblrpress.com> wrote:
[WeeblrPress] Reply to your public ticket #29 Fatal Error Installation [weeblrAMP]

Friday, 28 April 2017 18:22 UTC
wb_weeblrpress
Hi

Thanks for getting back to me. Hope the server move goes well, you should be fine however with the nex dev version (use that instead of the currently official one - we will have an update soon anyway).

Let me know how it goes with the fixed leds collection thing, I am interested in what you come up with here!

Rgds
 
Saturday, 29 April 2017 19:42 UTC
hidohebhi
Hey…so I’ve been playing around with the plugin on one post (we’ve got about 1,200 we need to migrate eventually).  I like all the options and coding.
2 Questions:
1. None of the images on our posts will show.  All of the src data is drawing an empty 1px gif.  (See https://paleomagazine.com/pork-cabbage-stew-paleo-keto-aip/amp)
2. I was able to change the JSON data to type: Recipe with the "[wbamp-meta name="doc_type" content="NewsArticle”]” shortcode.  Is there anyway to also include a name element in that data (it’s also required per Schema markup for a recipe).
Thanks for all the help.
gFoulvEcRzCPUSitmZPs_Jeremy%20Hendon.png#logoJeremy Hendon
Live the Good Lifem:646.206.5553 | e:jeremy@jeremyhendon.com | w:http://jeremyhendon.comfacebook.png snapchat.png linkedin.png twitter.png instagram.png


On Apr 28, 2017, at 7:22 PM, WeeblrPress <weeblramp-ticket-reply@weeblrpress.com> wrote:
[WeeblrPress] Reply to your public ticket #29 Fatal Error Installation [weeblrAMP]

Sunday, 30 April 2017 17:41 UTC
wb_weeblrpress
Hi Jeremy,

Glad you like what you see so far!

1 - I can see images on that page now, so maybe this was solved? please advise.

2 - A good question. We have planned to add a meta box so that you can choose the AMP post type on post/pages editing pages, but that won't solve the second issue. We already played with adding more wbamp-meta capabilities but that's still tedious, and also kind of hard to scale, so:

- for the "name" property, I will add that for Recipes - we can use the page title I guess
- I will alo add a new wbamp-meta for "name", as "name" is a property for the "Thing" schema.org item, it's pretty much compatible with everything and should not cause many validation errors (when used on other page types)
- the real thing to do in that case, IMHO, would be to use a filter. We have just what you need: weeblramp_get_structured_data.

Not only can you set the "name" value but also maybe set the "doc_type" automatically, maybe based on current page post category or taxonomy, instead of having to add som wbamp-meta shortcodes into the content?

Please note that if you use filters, you cannot add them in your theme functions.php file, as your theme is not loaded at all on AMP pages. Instead you should use a functions.php file located in a weeblramp folder inside your theme, as described on this page of the documentation. weeblrAMP will load that functions.php file on all AMP pages.

Lastly, I see that your standard HTML page does have a full JSON-LD manifest, with all required structured data. Can I ask how you manage and produce this? maybe there is something we can do here, to just collect all existing structured data instead of working hard to painfully recreate them?

Rgds
 
Sunday, 30 April 2017 18:00 UTC
hidohebhi
Answers below.  
One other small bug (I think) - when I change the font-size in the backend for h1, h2, h3, etc., it updates the font size in the css, but it also leaves in the old font size (grouped in the same brackets).  And because the old font size is lower in the brackets, that’s the one that gets used. If you check the font-size for h3 on this page, for instance: https://paleomagazine.com/how-to-start-ketogenic-diet/amp
(Note that I’ve added in custom css to fix it at the moment, but you can see in the code where it’s got both 1.3em and 0.9em.  1.3em is the size I updated in the backend.)
And by the way, it’s just my thought, but you’ll probably do very well marketing this for Recipes. Still a ton of food and health bloggers, and good AMP + Schema might make more difference going forward for recipes than anything else, especially with the introduction of carousels and other things by Google.
1 - That issue must have been a caching problem, because it went away.
2 - Your hook makes complete sense for the microdata.  Should be easy on our end.
For our JSON LD data, we get it one of 2 ways.  If it’s a recipe post, then the recipe plugin we use (Tasty Recipes) builds that data.
If it’s not a recipe, here’s the code I wrote into my functions.php to get it and build it.  I hard-coded a few things (Organization, url, etc.), but those are things you already have inputs for on the backend.  
function add_article_schema() { if( is_single() ) { if( !has_tag( 'Recipe' ) ) { $article_Link = get_permalink(); $article_Title = get_the_title(); $article_Author = get_the_author_meta('display_name'); $article_Description = get_excerpt(100); $options = thrive_get_theme_options(); $postID = get_the_ID(); $featured_image_data = thrive_get_post_featured_image($postID, $options['featured_image_style']); $featured_image = $featured_image_data['image_src']; $articleDate = get_the_date('Y-m-d'); $articleModifiedDate = get_the_modified_date('Y-m-d'); echo <<<FIRBLOCK<script type="application/ld+json">{ "@context": "http://schema.org", "@type": "Article", "url": "$article_Link", "name": "$article_Title", "headline": "$article_Title", "datePublished": "$articleDate", "dateModified": "$articleModifiedDate", "author": "$article_Author", "description": "$article_Description", "image": "$featured_image",    "publisher": {        "@type": "Organization",        "name": "Paleo Flourish",        "url": "http://www.paleomagazine.com/",        "logo": {            "@type": "ImageObject",            "url": "http://paleomagazine.com/wp-content/uploads/2017/04/paleo-flourish-logo-site-small.png",            "width": 200,            "height": 41        }    }}</script>FIRBLOCK; } }}
add_action( 'wp_head', 'add_article_schema' );


gFoulvEcRzCPUSitmZPs_Jeremy%20Hendon.png#logoJeremy Hendon
Live the Good Lifem:646.206.5553 | e:jeremy@jeremyhendon.com | w:http://jeremyhendon.comfacebook.png snapchat.png linkedin.png twitter.png instagram.png


On Apr 30, 2017, at 6:41 PM, WeeblrPress <weeblramp-ticket-reply@weeblrpress.com> wrote:
[WeeblrPress] Reply to your public ticket #29 Fatal Error Installation [weeblrAMP]

Sunday, 30 April 2017 18:06 UTC
hidohebhi
Just as additional thought - I don’t know what the caching issue is, but some posts definitely lack some of the images for a while.  I haven’t done enough yet to test if they all get fixed.  But here’s one, for instance, where some of the images aren’t yet loaded: https://paleomagazine.com/microwave-paleo-bread/amp



On Apr 30, 2017, at 6:41 PM, WeeblrPress <weeblramp-ticket-reply@weeblrpress.com> wrote:
[WeeblrPress] Reply to your public ticket #29 Fatal Error Installation [weeblrAMP]

Monday, 01 May 2017 10:18 UTC
wb_weeblrpress
Hi

1 -
when I change the font-size in the backend for h1, h2, h3, etc.
How exactly do you do that? where do you change font size? throuhg wbAMP font-size setting under the "Customize" settings page?

2 - Images: I can see on this page https://paleomagazine.com/how-to-start-ketogenic-diet/amp this morning, the 1x1px gif being used. On the regular page, the image displayed is a simple jpg (this one)

I'm not sure why it's converted to a gif? What'sure is that the conversion is failing, as the resulting inlined GIF has only a few bytes. That images seems to be loaded from another domain, maybe some kind of CDN (netdna-ssl.com). Images served from this server seems to fail all. Can you tell me something about it? what is this domain? how do you integrate it into your pages?

Rgds


 
Monday, 01 May 2017 11:49 UTC
wb_weeblrpress
Hi again

As for the font size, this is a bug, the font-size = 0.9em is actually hardcoded in the source CSS (the one that's being overriden based on your admin input). I'll have a fixed version in a few minutes.

I did found that only for h3 though, not for the other heading classes.

Rgds
 
Monday, 01 May 2017 12:48 UTC
hidohebhi
First of all, your suggestion for the top bar works very well.
For the other questions - 
1. You’re right, it was only the h3.
2. That’s MaxCDN (hosts all of our images, etc.).  It’s integrated through W3TC.  
gFoulvEcRzCPUSitmZPs_Jeremy%20Hendon.png#logoJeremy Hendon
Live the Good Lifem:646.206.5553 | e:jeremy@jeremyhendon.com | w:http://jeremyhendon.comfacebook.png snapchat.png linkedin.png twitter.png instagram.png


On May 1, 2017, at 11:18 AM, WeeblrPress <weeblramp-ticket-reply@weeblrpress.com> wrote:
[WeeblrPress] Reply to your public ticket #29 Fatal Error Installation [weeblrAMP]

Monday, 01 May 2017 16:25 UTC
wb_weeblrpress
Hi again

Regarding json-ld structure data:

1 -
For our JSON LD data, we get it one of 2 ways. If it’s a recipe post, then the recipe plugin we use (Tasty Recipes) builds that data.

If it’s not a recipe, here’s the code I wrote into my functions.php to get it and build it. I hard-coded a few things (Organization, url, etc.), but those are things you already have inputs for on the backend.


First, you should note that for regular content (ie not recipes), json-ld for AMP pages is generated automatically, you should not have anything to do.

For Recipes, I have added automatic creation of the "name" tag, based on the item title. There is also now a "doc_name" meta tag you can put in your content, in case the automatically computed one is not the best.

Ideally, I will add some support for a few Recipes plugins. I guess WP Ultimate Recipe should be first.

So for now you can get an updated dev version from the development versions download area area. It will add the "name" field for you when the document type is "Recipe".

2 - I have also made some sample functions.php overrides which you may be able to use: As mentioned earlier, do not put the content of this file in your theme root folder. There is a specific AMP functions.php file, and you should create it under /wp-content/themes/{your-theme}/weeblramp/functions.php

Here is a sample functions.php:
<?php
/**
 * Sample frontend functions.php for weeblrAMP
 */

// Security check to ensure this file is being included by a parent file.
defined( 'WEEBLRAMP_EXEC' ) || die;

/**
 * 1. Change the document type based on the request.
 * This filter is triggered BEFORE reading user-defined data from the content
 * (ie: wbamp-meta shortcodes)
 */
add_filter(
	'weeblramp_json_manifest',
	function ( $jsonld, $pageData ) {

		// set document type based on post
		$post = WeeblrampHelper_Content::getPostFromPageData( $pageData );
		if ( ! empty( $post ) && 'single' == wbArrayGet( $pageData, 'request_type' ) ) {
			$isSingle       = is_single();
			$isRecipe       = has_tag( 'Recipe' );
			$title          = $post->post_title;
			$article_Author = get_the_author_meta( 'display_name', $post->post_author );

			$postCategories   = wp_get_post_categories( $post->ID );
			$recipeCategories = array( 12, 34, 56, 85 );
			// set document type
			if ( $isSingle && ( $isRecipe || array_intersect( $postCategories, $recipeCategories ) ) ) {
				$jsonld['@type'] = 'Recipe';
			}
		}

		return $jsonld;
	},
	10,
	2
);

/**
 * 2. Filter json-ld data to add support for recipes.
 * This filter is triggered AFTER reading user-defined data from the content
 * (ie: wbamp-meta shortcodes)
 */
add_filter(
	'weeblramp_get_jsonld_data',
	function ( $jsonld, $pageData ) {

		$docType = wbArrayGet( $jsonld, '@type' );
		if ( 'Recipe' == $docType ) {
			$jsonld['cookTime']         = 'PT1H';
			$jsonld['prepTime']         = 'PT30M';
			$jsonld['recipeIngredient'] = array(
				'Cheese',
				'Sugar',
				'Lemon'
			);
		}

		return $jsonld;
	},
	10,
	2
);



You should be able to use that to automatically set some data from your posts. If you can get your hand on some appropriate filters from TastyRecipes, you may also be able to inject automatically the structured data it produces.

3 - As for the missing images, this puzzles me a bit. I don't see why the images are turned into optimized GIF right now. I have not tested W3TC, only SuperCache, and I didn't expect any issue there. Now testing your exact setup might be a bit tricky as it would also require a MAXCDN account, which I don't have. We do use cloudflare to host our images, including on AMP, and I never saw any issue.

Can I suggest trying to disable W3TC on AMP pages (from the "Comments & plugins" tab in weeblrAMP configuration)?

Rgds
 
Monday, 01 May 2017 16:43 UTC
wb_weeblrpress
Hi

Forgot to mention, you might want to add your /weeblramp/functions.php file in a child-theme to avoid it being overriden during next theme update.

Rgds
 
Monday, 01 May 2017 17:57 UTC
wb_weeblrpress
HI

OK, I have checked again the https://paleomagazine.com/microwave-paleo-bread/amp and the https://paleomagazine.com/how-to-start-ketogenic-diet/amp pages, and they both work fine right now, with images being displayed normally.

Frankly, I don't think this is something caused by weeblrAMP. I mean it surely happen on AMP pages, but unless you changed some settings today, it can only be something in either W3TC or MaxCDN that finally decided to work.

I would think more W3TC, as it is the actual content of the page that's changed. This morning the <img> tag src attribute was a data:image, now it's a standard link to a jpg. As the content is created on your server, surely W3TC is the only which can alter the page content on the fly.

Rgds
 
Monday, 01 May 2017 18:00 UTC
hidohebhi
Yeah - we have someone working on the site, and they turned off our CDN for a while.  So that’s likely the cause of the change.
gFoulvEcRzCPUSitmZPs_Jeremy%20Hendon.png#logoJeremy Hendon
Live the Good Lifem:646.206.5553 | e:jeremy@jeremyhendon.com | w:http://jeremyhendon.comfacebook.png snapchat.png linkedin.png twitter.png instagram.png


On May 1, 2017, at 6:57 PM, WeeblrPress <weeblramp-ticket-reply@weeblrpress.com> wrote:
[WeeblrPress] Reply to your public ticket #29 Fatal Error Installation [weeblrAMP]

Monday, 01 May 2017 18:13 UTC
wb_weeblrpress
Hi

Ah good, but the analysis is the same. Most likely, it's something in W3TC transforming those images. weeblrAMP itself does not any code to turn images into base64-encoded version of themselves, so it has to be done by another plugin.

Once the CDN is enabled back, can you test disabling (on AMP pages) W3TC, and then maybe other optimzation plugins you may have?

Rgds

 
Monday, 01 May 2017 18:50 UTC
wb_weeblrpress
Hi

So after digging a bit more, W3TC does have specific support for AMP pages. I looked at it and it basically only consists in disabling some of the optimization happening on normal pages.

To detect AMP, they use the is_amp_endpoint() function the standard Automattic plugin provides. I emulated this function initially, but it seems I have removed it at some point and for some reason. So I think W3TC does not know it is rendering an AMP page, and because of that, it does some modifications that are breaking the rendering.

I have added back the is_amp_endpoint() function in the current development version (get it from the development versions download area). If you use this version, and make sure to enable the "AMP plugin" extension of W3TC, then this might provide a better compatibililty and maybe solve this.

Let me know.

Rgds
 
Tuesday, 16 May 2017 05:34 UTC
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.