Difference between revisions of "6CS028 Workshop - Web Frameworks"

From mi-linux
Jump to navigationJump to search
Line 37: Line 37:
  
 
If you are getting the following error message:
 
If you are getting the following error message:
 +
 +
<pre>
 
Warning: _cake_core_ cache was unable to write 'cake_dev_en-gb' to File cache in /studhome/staff/acad/in9352/public_html/cake/lib/Cake/Cache/Cache.php on line 309
 
Warning: _cake_core_ cache was unable to write 'cake_dev_en-gb' to File cache in /studhome/staff/acad/in9352/public_html/cake/lib/Cake/Cache/Cache.php on line 309
 +
</pre>
  
 
You need to make the "app/tmp" folder (and all its sub-folders) '''writable''' by all in order to solve this.
 
You need to make the "app/tmp" folder (and all its sub-folders) '''writable''' by all in order to solve this.
  
If you are still getting cache errors/warnings after this, it might be because the version of PHP running on the server is too old, and caching doesn't work (we have 5.2.4 and the documentation says it should be 5.2.8 or more). You could always hide the errors by changing this line in the Config/core.php file:
+
If you are still getting cache errors/warnings after this, it might be because the version of PHP running on the server is too old, and caching doesn't work (we have 5.2.4 and the documentation says it should be 5.2.8 or more). You could always disable the cache in the Config/core.php file. Simply '''remove''' the following blocs located at the bottom of the file.
  
 
<pre>
 
<pre>
Configure::write('debug', 0);
+
/**
 +
* Configure the cache used for general framework caching.  Path information,
 +
* object listings, and translation cache files are stored with this configuration.
 +
*/
 +
Cache::config('_cake_core_', array(
 +
'engine' => $engine,
 +
'prefix' => $prefix . 'cake_core_',
 +
'path' => CACHE . 'persistent' . DS,
 +
'serialize' => ($engine === 'File'),
 +
'duration' => $duration
 +
));
 +
 
 +
/**
 +
* Configure the cache for model and datasource caches.  This cache configuration
 +
* is used to store schema descriptions, and table listings in connections.
 +
*/
 +
Cache::config('_cake_model_', array(
 +
'engine' => $engine,
 +
'prefix' => $prefix . 'cake_model_',
 +
'path' => CACHE . 'models' . DS,
 +
'serialize' => ($engine === 'File'),
 +
'duration' => $duration
 +
));
 
</pre>
 
</pre>
  

Revision as of 16:44, 7 February 2013

Main Page >> Advanced Web Technologies >> Workbook >> Week 02

Consider using a PHP framework for your assessment. Here are some popular ones:

CodeIgniter

Yii

CakePHP

mod_rewrite

Note that because of the way mod_rewrite is set up on the server you need to add a RewriteBase line in the existing .htaccess file, as follow:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteBase /~0123456/cake
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

IMPORTANT: Replace "0123456" with your student number and "cake" by the folder in which you have uploaded the framework.

Alternatively you could NOT use mod_rewrite, the tutorial above tells you how (see "A Note on mod_rewrite" section)

Cache

If you are getting the following error message:

Warning: _cake_core_ cache was unable to write 'cake_dev_en-gb' to File cache in /studhome/staff/acad/in9352/public_html/cake/lib/Cake/Cache/Cache.php on line 309

You need to make the "app/tmp" folder (and all its sub-folders) writable by all in order to solve this.

If you are still getting cache errors/warnings after this, it might be because the version of PHP running on the server is too old, and caching doesn't work (we have 5.2.4 and the documentation says it should be 5.2.8 or more). You could always disable the cache in the Config/core.php file. Simply remove the following blocs located at the bottom of the file.

/**
 * Configure the cache used for general framework caching.  Path information,
 * object listings, and translation cache files are stored with this configuration.
 */
Cache::config('_cake_core_', array(
	'engine' => $engine,
	'prefix' => $prefix . 'cake_core_',
	'path' => CACHE . 'persistent' . DS,
	'serialize' => ($engine === 'File'),
	'duration' => $duration
));

/**
 * Configure the cache for model and datasource caches.  This cache configuration
 * is used to store schema descriptions, and table listings in connections.
 */
Cache::config('_cake_model_', array(
	'engine' => $engine,
	'prefix' => $prefix . 'cake_model_',
	'path' => CACHE . 'models' . DS,
	'serialize' => ($engine === 'File'),
	'duration' => $duration
));

Not ideal though :/

Symfony

Akelos

Zend Framework

IMPORTANT: So far I have not managed to successfully install Zend on mi-linux :(