PHP generated CSS not taking effect

What I have:

A style-color.php document that dynamically writes/outputs CSS code that should ordinarily be applied to my website’s pages (note: this is a theme file for a WordPress based website).

My problem:

The file works perfectly locally however does not on my live website. By process of elimination, the only real difference that come to mind between my local and live environments are security hardening measures I’ve applied to the live environment and potentially chmod settings.

Read More

Security hardening:
I’ve disabled various security hardening measures but to no avail.

Screenshot

chmod settings:
The style-colors.php is contained in themes > some-theme-name > style-colors.php and the respective permissions are 755 > 755 > 644.

My question:

Is there anything obvious I’m overlooking with regards to the permissions or anything else that might be preventing style-colors.php from behaving as it should?

Related posts

Leave a Reply

1 comment

  1. try this code it be work.

        <?php
        $root = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
        if ( file_exists( $root.'/wp-load.php' ) ) {
            require_once( $root.'/wp-load.php' );
        } elseif ( file_exists( $root.'/wp-config.php' ) ) {
            require_once( $root.'/wp-config.php' );
        }
        header("Content-type: text/css");
        // start output buffer
        ob_start();
    
    
        $theme_color="#d5266c";
     ?>
        a:hover,
        a:focus{
            color:<?php echo $theme_color;?>;
        }