php safe mode


(system) #1

Hi,

Is it possible to use the yii framework in a php safe mode restricted environment? I tried deploying a bare bones project on the server but i got this error:

copy() [<a href='function.copy'>function.copy</a>]: SAFE MODE Restriction in effect. The script whose uid is 10169 is not allowed to access httpdocs/b4u/assets/87675fa2 owned by uid 48.

#0 httpdocs/b4u/framework/utils/CFileHelper.php(108): copy()

#1 httpdocs/b4u/framework/utils/CFileHelper.php(110): copyDirectoryRecursive()

#2 httpdocs/b4u/framework/utils/CFileHelper.php(46): copyDirectoryRecursive()

#3 httpdocs/b4u/framework/web/CAssetManager.php(157): copyDirectory()

#4 httpdocs/b4u/framework/web/CClientScript.php(192): publish()

#5 httpdocs/b4u/framework/web/CClientScript.php(225): getCoreScriptUrl()

#6 httpdocs/b4u/framework/web/CClientScript.php(108): renderCoreScript()

#7 httpdocs/b4u/framework/web/CClientScript.php(84): renderHead()

#8 httpdocs/b4u/framework/web/CController.php(236): render()

#9 httpdocs/b4u/framework/web/CController.php(429): processOutput()

#10 httpdocs/b4u/protected/controllers/SiteController.php(45): render()

#11 httpdocs/b4u/framework/web/actions/CInlineAction.php(32): actionLogin()

#12 httpdocs/b4u/framework/web/CController.php(218): run()

#13 httpdocs/b4u/framework/web/CController.php(203): runAction()

#14 httpdocs/b4u/framework/web/CController.php(178): runActionWithFilters()

#15 httpdocs/b4u/framework/web/CWebApplication.php(149): run()

#16 httpdocs/b4u/framework/web/CWebApplication.php(121): runController()

#17 httpdocs/b4u/framework/base/CApplication.php(146): processRequest()

#18 httpdocs/b4u/index.php(11): run()

Does anyone have anymore information about this situation?

Thanks,

Tim


(B37hr3z3n) #2

i've also met this problem


(Dyrathror) #3

I can only advise you to ask your provider to switch the SAFE_MODE off.

It will not be included in future PHP versions anyway.

D.


(B37hr3z3n) #4

It's not a good idea. Hoster will not do this.


(Ckuetbach) #5

Those script are owned by different User (uid)

Can you change the ownership of these files?

Christian


(B37hr3z3n) #6

In this case it might be piece a cake. But I can't. I only have FTP access to httpdocs directory. No ssh at all. chmod 0777 to assets/* doesn't help.

For example blog demo application should create jquery.js there. But it does n't.


(Qiang Xue) #7

In this environment, how would you use a script to create a subdirectory and upload files into it?


(Ckuetbach) #8

Would it be a solution for you, to start the Yii-Application locally and create the assets/* Files on a local system.

You can put these files to the FTP-Server. Then you would be the owner.

Christian

PS:

I Don't know, when and how Yii creates the JS-files in assets/*


(Aotuong) #9

I already met that problem too!

Thanks for your advice.


(Drealtarzan) #10

To solve problem. Transfer your locally created assets folder with it’s contents to server using ftp. This will ensure hosted assets folder and it’s contents have appropriate owner/group id.

With everything else setup correctly look at assets error message displayed on screen. Using error example above.

Open your hosted assets folder on server, you should see two sets of folders distinguishable by uid. Open the folders with uid not 48 and search for one containing the right js files.

When files found, rename that folder to 87675fa2 based on our example. Then grant the folder and subfolders 777 permissions.

This should now work. Just repeat the process for the other assets related errors. The same solution should be applied if you get a mkdir() problem too related to assets.