Announcement

Collapse
No announcement yet.

mod_pagespeed and php selector

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • mod_pagespeed and php selector

    I've installed mod_pagespeed from easyapache4. I followed these instructions https://support.cpanel.net/hc/en-us/...ividual-domain to enable mod_pagespeed for specific accounts only.

    I'm using cloudlinux php selector to set php version.

    mod_pagespeed is working for html such as index.html, css, and js files served by apache.

    However, mod_pagespeed is not working for php pages served by cloudlinux php_selector such as index.php

    Is there a way to get mod_pagespeed to work with php pages with php_selector secure php version?


  • #2
    We tried reproducing the issue on our lab servers and seems the issue is not related to PHP packages, and is not related to the CageFS enabled/disabled. We were not able to make the individual mod_pagespeed working for any domain if it is disabled globally even with native PHP. Can you please confirm it's working with PHP when enabled globally? Do you use mod_lsapi as PHP engine?

    Comment


    • #3
      Thanks very much for taking a look.

      Yes, mod_pagespeed is working with PHP when enabled globally.

      I'm running php as fcgi, php selector with php 7.3/7.4, and cagefs enabled.

      With /etc/apache2/conf.modules.d/510_pagespeed.conf set to ModPagespeed on, multiple individual css and js files called from index.php are combined into an optimized css / optimized js file and the html lines in the index.php output then have a call to the mod_pagespeed-combined css and combined js file; mod_pagespeed is altering the html of the php file to optimize and optimizing the called js/css components.The X-modpagespeed header appears when viewing the php file in chrome developer tools -> network -> headers
      (sub-note: ModPageSpeedEnableFilters rewrite_css, ModPageSpeedEnableFilters rewrite_javascript, ModPageSpeedEnableFilters combine_css, ModPageSpeedEnableFilters combine_javascript work when enabled in .htaccess for a single site for php files with mod_pagespeed enabled globally, but ModPageSpeedEnableFilters remove_comments and ModPageSpeedEnableFilters collapse_whitespace only work for php files when enabled in global 510_pagespeed.conf; these latter two work for html files when enabled in .htaccess.)

      With ​ModPagespeed off in the /etc/apache2/conf.modules.d/510_pagespeed.conf and ModPagespeed on in /home/site/www/.htaccess, the html source of index.php is not altered to combine multiple css / js files.
      (sub-note: testing was inconsistent in the following regard: the html within a php file was never optimized with mod_pagespeed disabled globally and enabled with .htaccess, and multiple css/js files were not combined, but in some tests the js and css files called by the index.php file were optimized rewritten by mod_pagespeed; In other tests it was necessary to add text/css and text/javascript to the AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html in 510_pagespeed.conf and it required several reloads; I'm not clear why it optimized the called js and css files in some tests without those added and in other tests not until text/javascript and text/css were added; with it enabled globally it optimizes and combines the called files without having to add the additional types to the OUTPUT_FILTER line.)

      mod_pagespeed is interesting as it gives the mobile lighthouse score a noticeable improvement on some sites where scripts are complicated and have lots of individual css/js calls/comments, etc.,

      But it would be great if it were possible to enable it on a per-account basis as I don't want to risk introducing glitches to all accounts unless the site could benefit in a noticeable way. (and much easier to enable on an account-by-account basis to give time to spot any possible glitches it could introduce)

      I'm also not sure if mod_pagespeed would introduce security concerns the way it caches all sites in a cache directory outside of cagefs... (?)


      Easyapache settings:
      Code:
      {
      "name" : "mod_pagespeed enabled",
      "pkgs" : [
      "ea-apache24",
      "ea-apache24-config",
      "ea-apache24-config-runtime",
      "ea-apache24-mod_bwlimited",
      "ea-apache24-mod_cgid",
      "ea-apache24-mod_deflate",
      "ea-apache24-mod_expires",
      "ea-apache24-mod_headers",
      "ea-apache24-mod_hostinglimits",
      "ea-apache24-mod_http2",
      "ea-apache24-mod_mpm_event",
      "ea-apache24-mod_pagespeed",
      "ea-apache24-mod_proxy",
      "ea-apache24-mod_proxy_fcgi",
      "ea-apache24-mod_proxy_http",
      "ea-apache24-mod_proxy_wstunnel",
      "ea-apache24-mod_security2",
      "ea-apache24-mod_ssl",
      "ea-apache24-mod_suexec",
      "ea-apache24-mod_unique_id",
      "ea-apache24-mod_version",
      "ea-apache24-tools",
      "ea-apr",
      "ea-apr-util",
      "ea-brotli",
      "ea-cpanel-tools",
      "ea-documentroot",
      "ea-freetds",
      "ea-freetds-libs",
      "ea-libargon2",
      "ea-libcurl",
      "ea-libicu",
      "ea-libmcrypt",
      "ea-libnghttp2",
      "ea-libtidy",
      "ea-libxml2",
      "ea-libzip",
      "ea-modsec-sdbm-util",
      "ea-nghttp2",
      "ea-oniguruma",
      "ea-oniguruma-devel",
      "ea-php-cli",
      "ea-php-cli-lsphp",
      "ea-php83",
      "ea-php83-pear",
      "ea-php83-php-bcmath",
      "ea-php83-php-bz2",
      "ea-php83-php-cli",
      "ea-php83-php-common",
      "ea-php83-php-curl",
      "ea-php83-php-dba",
      "ea-php83-php-devel",
      "ea-php83-php-enchant",
      "ea-php83-php-exif",
      "ea-php83-php-fileinfo",
      "ea-php83-php-ftp",
      "ea-php83-php-gd",
      "ea-php83-php-gettext",
      "ea-php83-php-gmp",
      "ea-php83-php-iconv",
      "ea-php83-php-ldap",
      "ea-php83-php-litespeed",
      "ea-php83-php-mbstring",
      "ea-php83-php-odbc",
      "ea-php83-php-pdo",
      "ea-php83-php-pgsql",
      "ea-php83-php-posix",
      "ea-php83-php-process",
      "ea-php83-php-pspell",
      "ea-php83-php-snmp",
      "ea-php83-php-soap",
      "ea-php83-php-sockets",
      "ea-php83-php-tidy",
      "ea-php83-php-xml",
      "ea-php83-runtime",
      "ea-profiles-cloudlinux",
      "ea-profiles-cpanel"
      ],
      "tags" : [],
      "version" : "0.1",
      "desc" : "pagespeed on for individual sites"
      }​

      Comment

      Working...
      X