Thursday, February 10, 2022

[FIXED] Yiiframework can't load js & css resource

Issue

I have my Yii application worked well on Windows Server. But when I deploy it on Centos server, the js and css files cannot be loaded. I got 404 error, CHttpException.

Source code to load resource:
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl.'/css/custom.css');
     Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl.'/js/jquery-1.7.1.min.js');

In addition, I have 4 Yii web applications deploy on the same server. And the other ones work well. Does anyone know the reason why? Can it be a security error on Centos that does not publish themes folder?

Please help me on this.

TIA,


Solution

I think it's permissions problem. Check permissions of your files and folders (can web-server process access them)



Answered By - driver_by

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.