• 0

Pagelines generating css dynamically

Question

Posted · Report post

Hi, I run a mutlisite installation of WordPress at Syracuse University on Pagelines framework.  Following are the URLs:

Main site: http://honors.syr.edu

Project site: http://honors.syr.edu/Capstone

Civic site: http://honors.syr.edu/Civic

 

 

 My server admins are concerned (and my site is crashing!) because my site is routinely taking more than the 120 MB PHP memory limit to load, and it is creating a ton of problems.  They are telling me that I need to make Pagelines framework generate CSS differently.  I am NOT a programmer. I am a designer, and I know enough css/html to hack my way around WordPress and Chrome development tools.  I have not a clue how to fix this issue.

 

Below is the text of the email I received from the server admins explaining the issue. Can someone please help me?  I have attached my debug info.

 

The issue is there's a separate call for css to be generated, every time. The css generation is the memory expensive action -- it's the thing that the less people suggest you not do with less in production.

 

Can the Pagelines people give you help on a) generating a static css file locally on your machine and B) configuring the Pagelines theme to read the static file that you generated locally? Do they have any recommendation here? It would be awesome, really awesome, if they could give you a solution for this asap -- we would really like to drop that setting back down asap because it does leave us a little vulnerable to getting choked.

Share this post


Link to post
Share on other sites

14 answers to this question

  • 0

Posted · Report post

Hi,

 

Try adding the following into your child theme or customize plugins functions.php file.

 

add_filter( 'render_css_posix_', '__return_true' );

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

thanks, I will try it.  I currently am using the iBlogPro child theme, so just to be clear I'm thinking it should go into: wp-content/themes/pagelines-idblogpro5/ and the file I will add it to is 'functions.php'

 

But I am not sure where I should add it.  It looks like some of the filters at the top, but do I just add it to the bottom? I can paste the php code here... but it's kind of long.

 

Sorry to be such a newbie, but I don't like to mess with php so I just want to be real sure of where to put this so I don't crash my site, and further anger the server admins. 

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

The code I provided goes into the functions.php file of your child theme. Therefore, if you're using iBlogPro 5 then you add that code to iBlogPro 5 functions.php file like you mentioned in your previous post.

Also, there shouldn't be a lot of code in iBlogPro 5 functions.php file, unless you have added it yourself. Can you paste the full context of your functions.php file to:

 

http://paste.pagelines.com

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Thanks for the info. Here is the link to the functions.php file in the following location on my site:  wp-content/themes/pagelines-idblogpro5/ 

 

pasted code is at: http://paste.pagelines.com/w6sefrhu

 

I agree there's quite a bit, but I didn't put any there and no one else would I don't think.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

OK, that is just the default as far as I can tell. Anyway, add the snippet of code I gave you above, to the bottom of the iBlogPro 5 functions.php file and see if this resolves your issue.

 

If this doesn't resolve your issue, you will need to contact your host and ask them to resolve the following info, which can be found on your debug info.

 

PHP Open basedir restriction : Yes!

PHP User : Posix functions are disabled on this host!

 

http://honors.syr.edu/?pldebug=1

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Sorry, I am not understanding. How would they resolve the info? What is wrong with the info? I don't think they are going to change the policy for the server just because I have a theme that doesn't generate CSS efficiently.  Pagelines is supposed to be generating a static .less file, right?  Here is exactly what they want Pagelines to do:

 

Right now, there's a separate call for css to be generated, every time. The css generation is the memory expensive action -- it's the thing that the less people suggest you not do with less in production.

 
Can the Pagelines people give you help on a) generating a static css file locally on your machine and b) configuring the Pagelines theme to read the static file that you generated locally?

 

So my question is... will the code you gave me do points a) and b) ?  If not, is there a way Pagelines can do point a) and b)?  Is it really a hosting issue on my end?  Because it's the hosting people who are having the problem with my site, and sending me to you.

 

I really need help resolving this, and I'm willing to pay for additional developer support if I need to, or purchase whatever plan entitles me to professional support.

 

Thanks very much! 

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Sorry, I am not understanding. How would they resolve the info? What is wrong with the info? I don't think they are going to change the policy for the server just because I have a theme that doesn't generate CSS efficiently.  Pagelines is supposed to be generating a static .less file, right?  Here is exactly what they want Pagelines to do:

 

So my question is... will the code you gave me do points a) and B) ?  If not, is there a way Pagelines can do point a) and B)?  Is it really a hosting issue on my end?  Because it's the hosting people who are having the problem with my site, and sending me to you.

 

I really need help resolving this, and I'm willing to pay for additional developer support if I need to, or purchase whatever plan entitles me to professional support.

 

Thanks very much! 

did you at least try adding that filter danny gave you? It bypasses the posix functions check.

 

posix functions are installed by default with PHP, your host has chosen not to allow the extension. php posix allows the framework to check you actually own the files/folders so it can write a static css file, if the check fails it wont write a file, simple as that. All we can suggest is that you add the filter to your child theme functions.php to bypass that check.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi, Yes I did add the code yesterday.  I am waiting for some kind of confirmation back from the hosting folks that it worked.  I don't have any way of checking if it is working.  Thanks for further information though, I will definitely post an update when I hear back from the hosting department.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

OK keep us posted.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi,  Sorry it took so long to get a response to this. Our IT department has been swamped with end of year projects.  I asked them if the line of code made any difference. They said 'no', it's still generating CSS dynamically and costing them too much load on the server.  Here is the exact text of the email I received from the IT department: 

 

Right now the Pagelines theme dynamically generates CSS. That action takes about 140MB of RAM. Regardless of whether the CSS is made with each page load, or more infrequently then cached, or made once (via the wp admin panel) then saved/referenced, the theme is requiring the server to do the work here. At some point the server is being tasked with supplying resources to generate CSS which takes 140MB.

 

140MB is above our max memory limit per php process. Ideally our max is around 120MB, which was calculated to avoid critical performance dips. We have it temporarily at 140MB, but need to get it back closer to 120MB.

 

What other options can Pagelines give you? Do they have a method for you to make the CSS file locally on your computer and then upload a static file? The theme would need to know to use that static, compiled CSS file. I had been on the Pagelines forums back when you reported this and it sounded like there were others who have had this issue before. Do they have any suggestions besides increasing the max memory limit? I'm looking for an option that would not involve your wp admin panel to make the css file.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi there,

 

Have you also added the below code to the wp-config.php? Looking on a previous post from our developer this forces Pagelines to write the CSS/LESS file and cache it, rather than dynamically generate it for every user request.

 

define( 'LESS_FILE_MODE', true );

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

James,

I'm having a similar issue.

I tried both pieces of code you suggested above (wp-config and functions) - no luck.

I tried each on their own and then all together. No change.

 

I've also started a thread about the file needing to pass through for caching here:

http://forum.pagelines.com/topic/32032-which-file-generates-the-css-need-to-tell-caching-which-file-to-let-pass-through/

 

I have learned that Posix functions on the server are disabled... will that do it?

 

 

- Andrew

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

The filter Danny gave your on the 18th nov totally bypasses the posix functions check.

 

If you have the posix bypass filter in place and the framework still cant write a file then there is either no folder to write too or permissions are just too restrictive.

 

Looking at the url 'edu' im assuming its going to be some locked down college/uni server?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Thanks  tpldrew"] for the info. I'll explore your thread.  @[member="Simon_P, I have put in both pieces of code, in both places, with no luck.  I will take the information about the permissions possibly being too restrictive back to the server admins.  I have spoken with them about this and they don't think that's the case.  Yes, it is a Syracuse University server, but it's the public server that is NOT all locked down that our site is on.  Pagelines is used as the framework for the Honors Program sites. I am not a student, and we pay for the service. We are planning to migrate to DMS, but if I can't get this issue solved, then I have to take the program away from Pagelines products altogether.  I do NOT want to do that.  

 

Can you tell me the following:

(1) To which folder should Pagelines be writing the file?  I can have them check the permissions on that folder.

(2) Is there a higher level of paid support I can escalate this to?  Is there a developer who would be willing to really poke around in our site, or communicate with my contact in the server admin team? 

 

Thank you,

Blythe 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now