Jump to content


Photo
- - - - -

Pagelines generating css dynamically


  • Please log in to reply
14 replies to this topic

#1 bscherr

bscherr

    Advanced Member

  • Members

  • 36 posts
  • Country: Country Flag

Posted 18 November 2013 - 02:12 PM

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

Main site:

Please Login or Register to see this Hidden Content

Project site: http:/

Please Login or Register to see this Hidden Content

Civic site:

Please Login or Register to see this Hidden Content

 

 

 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.

Attached Files



#2 Danny

Danny

    Is Awesome!

  • Moderators
  • 15047 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 18 November 2013 - 02:33 PM

Hi,

 

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

 

add_filter( 'render_css_posix_', '__return_true' );



#3 bscherr

bscherr

    Advanced Member

  • Members

  • 36 posts
  • Country: Country Flag

Posted 18 November 2013 - 02:50 PM

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. 



#4 Danny

Danny

    Is Awesome!

  • Moderators
  • 15047 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 18 November 2013 - 03:06 PM

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:

 

Please Login or Register to see this Hidden Content



#5 bscherr

bscherr

    Advanced Member

  • Members

  • 36 posts
  • Country: Country Flag

Posted 18 November 2013 - 03:20 PM

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: 

Please Login or Register to see this Hidden Content

 

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



#6 Danny

Danny

    Is Awesome!

  • Moderators
  • 15047 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 19 November 2013 - 09:28 AM

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!

 

Please Login or Register to see this Hidden Content



#7 bscherr

bscherr

    Advanced Member

  • Members

  • 36 posts
  • Country: Country Flag

Posted 19 November 2013 - 02:54 PM

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! 



#8 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 19 November 2013 - 04:14 PM

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.



#9 bscherr

bscherr

    Advanced Member

  • Members

  • 36 posts
  • Country: Country Flag

Posted 19 November 2013 - 04:23 PM

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.



#10 Danny

Danny

    Is Awesome!

  • Moderators
  • 15047 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 20 November 2013 - 10:44 AM

OK keep us posted.



#11 bscherr

bscherr

    Advanced Member

  • Members

  • 36 posts
  • Country: Country Flag

Posted 17 December 2013 - 03:12 PM

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.



#12 James B

James B

    Advocate

  • Moderators
  • 5126 posts
  • LocationSurrey - UK
  • Country: Country Flag

Posted 18 December 2013 - 07:00 AM

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 );



#13 tpldrew

tpldrew

    Advanced Member

  • Members

  • 93 posts
  • Country: Country Flag

Posted 19 December 2013 - 12:59 AM

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:

Please Login or Register to see this Hidden Content

 

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

 

 

- Andrew



#14 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 19 December 2013 - 01:19 AM

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?



#15 bscherr

bscherr

    Advanced Member

  • Members

  • 36 posts
  • Country: Country Flag

Posted 19 December 2013 - 02:41 PM

Thanks  @

Please Login or Register to see this Hidden Content

for the info. I'll explore your thread.  @

Please Login or Register to see this Hidden Content

, 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