Php File Inside Assets: 500 Internal Server Error

  • I have a Yii App which publishes a PHP file (which is actually a dynamic CSS file with PHP content - mystyle.css.php).

  • I can access all other files inside assets without any issues (/assets/myjavascriptfile.js OK).

  • But when I try to access the file: /assets/mystyle.css.php I get a 500 Internal Server Error.

Can you help me out?! I’m running out of options.

In case you need it, my .htaccess file looks like:

RewriteEngine on

if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

otherwise forward it to index.php

RewriteRule . index.php


can you try by rename this file mystyle.css.php to mystyle_css.php

Besides other recommendations, also check your .htaccess file(s).

OK Guys, I appreciate your help. By looking at the source code of the Blank Page which gave the 500 Internal Server Error, I found the following comment:

<!-- SHTML Wrapper - 500 Server Error -->

I was able to successfully execute the PHP file by changing the permissions to 777 of:



This is clearly a security restriction from my hosting provider (Justhost).

I’m going to automate this process by playing arount with Yii CAssetManager’s following properties:

  • newDirMode integer the permission to be set for newly generated asset directories.

  • newFileMode integer the permission to be set for newly generated asset files.

Hope this helps someone!