Call to undefined function symlink() in CAssetManager.php

I receive the following error on my yii application everytime i try to navigate to the contact page. This only happens on the contact page


Fatal error: Call to undefined function symlink() in C:\xampp\htdocs\webapp\framework\web\CAssetManager.php on line 197

I don’t know if it has anything to do with my current configuration:



			// enable cookie-based authentication



		// uncomment the following to enable URLs in path-format

		'assetManager' => array(

             'linkAssets' => true,













			'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',



		// uncomment the following to use a MySQL database



            'connectionString' => 'DB_CONNECTION',

            'emulatePrepare' => true,

            'username' => 'DB_USER',

            'password' => 'DB_PWD',

            'charset' => 'utf8',

            'tablePrefix' =>'',



			// use 'site/error' action to display errors








					'levels'=>'error, warning',


				// uncomment the following to show log messages on web pages









symlink() is in core PHP. I guess its blocked on your environment as part of strengthening of the PHP security (hardened PHP, Suhosin patch, etc).

I bet this is run on some hosting environment, where such limitations are common.

Yeah, I was actually figuring out what wrong with my server configuration but the code was previously working and I haven’t touched anything but the configurations to display path based urls . The site is on my development machine and I am using xampp. This only happens on a single page which is contact but doesn’t happen to any controllers I am currently adding.

'assetManager' => array(

  //'linkAssets' => true,  // use links

  'linkAssets' => false,  // default, copy to /assets




I actually set that to true I don’t want it copying my “css/js/etc” to assets directory and create some symbolic link to my actual folders during development because I get too much files.

So is this because how contact.php view references it which uses a symlink?

because everytime i set it to true… my assets folder is filled with resources cache like stuff, and perhaps I don’t want this on development

symlink() is only available since PHP 5.3.0 and only supported on Win >= Vista. So check these prerequisites.

you either phrased badly or simply wrong:

symlink() is in PHP 4 and 5 but only since v5.3.0 available on Windows version of PHP.

check the doc link you sent… :slight_smile:

Oops, yes, sorry, forgot the “Windows” part :)

@Mike and @Boaz

Hi, thank you. That explains it I am using windows XP. However If you have a running copy of the default website example, Do you know the specific code that actually creates the symlinks on the contact page? Although I will not be using the contact page, It would be interesting to know what part of the code calls it.

simple “grep -r symlink htdocs” ? Oh, you’re using Windoze… B)

seriously: i just searched for “symlink” on the test app i’m playing with, which is based on yiic webapp htdocs and i saw no usage of ‘symlink()’ function. What do you mean by “default website” ?

Since you talk about assets and since the error is thrown from CAssetManager, maybe this class would be a good candidate?

Check your error… it say…

Fatal error: Call to undefined function symlink() in C:\xampp\htdocs\webapp\framework\web\CAssetManager.php on line 197

So… check the line 197 in CAssetManager… :)