[EXTENSION] phundament

Phundament 3 is an application foundation built upon a set if independent Yii modules and extensions such as user, rights, yiiext, gtc, ckeditor, jquery-file-upload, p3widgets and p3media.

The combination of p3widgets and p3media provides basic content management system (CMS) features, like dynamic widget creation and file management.

Combined in ckeditor, p3media acts as a ckfinder plugin which gives you the full power of HTML and media files for content creation via p3widgets.

It comes with a very minimalistic setup which integrates perfectly into an Yii web application skeletion and installs with one single command.

[size="5"]Extension Page (Download, Installation, …)[/size]

from: extension page:

More informations:

  • linux dev box with php 5.3.2, mysql 5.1.41 , apache 2.2.14 , yii 1.1.8

  • I have had to comment all the stuff related to foreign keys in the migration files to be able to install the application


I am a bit confused … the demo page runs also on Linux, with almost the same setup as yours?!

Which download did you grab, the one from Yii extensions?

Please post the non-working URLs here, starting from index.php or your webapp folder.

For debugging … can you try to set in config/main urlManager:

'urlFormat' => 'get',

and see if this makes any difference.

Were the tables created as MyISAM instead of InnoDB?

When we’ve fixed this, we’ll move on to the gii stuff.



Thank you for help.

Well, do not panic too much :wink:

I’ve installed the same phundament distribution (the one from the yiiframework/extensions/phundament page) on an another computer (with almost the same configuration) and, except the troubles with migrations, application works well.

Non working urls:

  • /rights/authItem/permissions

  • /rights/authItem/roles

  • /rights/authItem/tasks

  • /rights/authItem/operations

  • /user/profileField/admin

  • /user/profileField/view/1

  • /user/profileField/update/1

  • /p3media/p3Media/admin

  • /p3media/p3Media/6

  • /gii/fullCrud

  • /gii/fullModel

weblog messages always showing: "Loading "XXX" module" with XXX= p3media, gii, rights or user and after that, throw a Http 404 exception.


  • Alias "CommandGenerator.widgets.ddeditor.DDEditor" is invalid while calling /gii/command

  • Alias "PortletGenerator.widgets.ddeditor.DDEditor" is invalid while calling /gii/portlet

Changing urlFormat from "path" to "get" give same error with for example: ?r=rights/authItem/permissions

Database tables:

some of them were created as MySam (the four "migration_module_XXX", "p3widget", the three "usr_XXX" user related tables) and other as InnoDb (the four tables for rights module, "p3_media", "p3_media_meta")

Hi again,

a fresh new install is working fine (except, database migrations and errors while calling portletgenerator and commandgenerator).

Why ? I don’t know yet.

Thank you for great job.


Nice! No panic yet :)

So p3media, user, rights, … is working fine?

Can you post the shell output when running migrations?

And portletgenerator and commandgenerator are the ones from gii (gtc)?

Is this about the same problem?

Something is going wrong with the foreign keys, but I can’t tell it yet.

While looking at it … could you try fixing the case for the referenced table.

$this->addForeignKey('fk_authitem_parent', 'AuthItemChild', 'parent', 'authitem', 'name', null, null);

$this->addForeignKey('fk_authitem_parent', 'AuthItemChild', 'parent', 'authItem', 'name', null, null);

in /protected/modules/p3media/migrations/m110719_000000_init.php

But since you’re having also problems with p3_media this does not really make sense.

./yiic migrate --migrationPath=application.modules.p3admin.modules-install.rights.migrations --migrationTable=migration_module_rights --interactive=1


applying m110402_195159_init

    > create table AuthAssignment ... done (time: 0.159s)

    > create table AuthItem ... done (time: 0.092s)

    > create table AuthItemChild ... done (time: 0.085s)

    > create table Rights ... done (time: 0.084s)

    > add foreign key fk_authitem_parent: AuthItemChild (parent) references authitem (name) ...exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1005 Can't create table 'yii_p3.#sql-4d6_36c' (errno: 150). The SQL statement executed was: ALTER TABLE `AuthItemChild` ADD CONSTRAINT `fk_authitem_parent` FOREIGN KEY (`parent`) REFERENCES `authitem` (`name`)' in /var/www/yii/yii-1.1.8.r3324/framework/db/CDbCommand.php:336

Migration for p3item is not applied.

./yiic migrate --migrationPath=application.modules.p3media.migrations --migrationTable=migration_module_p3media --interactive=1

return no error

gtc command generator:

Alias "CommandGenerator.widgets.ddeditor.DDEditor" is invalid. Make sure it points to an existing PHP file.

error comes from file: protected/extensions/gtc/command/views/__comment.php

Hope it helps !


Hi Schmunk :)

I’ll check it out Real Soon Now - but take a look at this in the mean time:


It looks very familar, no? :)

Nice, definitely inspiring.

They do have HMVC to help them out, but it is extremely close to Phundament IMO. :)

Especially the P3 widgets.

I didn’t put much work into the UI yet, because it has to be fully functional first.

But I’ll will keep this in mind.

I’ve also added the automatic property detection for all widgets, see screenshots.

Just released Phundament 3-0.2, get if from http://www.yiiframework.com/extension/phundament/

Hi schmunk,

I just downloaded and tried to make phundament3 run. But I have some issues with the image uploader.

When i open the "upload" Page, the console error I get is:

Uncaught TypeError: Object [object Object] has no method 'prop'




The problem seems to be with the "prop" function call

$.getJSON($('#fileupload form').prop('action'), function (files) {

in the file "protected/extensions/p3extensions/widgets/jquery-file-upload/init.js".

Also when dropping a file in the browser a new error shows up … also not knowing what to do with the function "prop".

Uncaught TypeError: Object [object Object] has no method 'prop'














My OS is Windows 7 … maybe that could be the problem? During the installation everything seemed to be fine. - no errors.

… In your demo the image uploader works fine by the way.


Looks like an outdated jQuery version, did you try to run phundament with Yii 1.1.8?

Also, I am currently making some includes from CDNs here, so this won’t work offline yet.

Ahh, thanks a lot! … sorry for that (still had Version 1.1.6 running :-P)

Now the drag & drop seems to work, but a new error appears after pushing the "upload" button (in the column to the right of the file size)

In Chrome:

Error: SyntaxError: Unexpected token <

In Firefox:

Error: SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data 

The answer of the Server looks like this:

[{"name":"54th.jpg","size":42017,"type":"image\/jpeg","url":"\/test-phundament\/p3media\/p3Media\/update?preset=raw&path=1%2F54th.jpg","thumbnail_url":"\/test-phundament\/p3media\/file\/image?preset=thumb&path=1%252F54th.jpg","delete_url":"\/test-phundament\/p3media\/import\/uploadFile?path=1%2F?file=54th.jpg","delete_type":"DELETE"}]<br />

<font size='1'><table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'>

<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Fatal error: Call to undefined function mime_content_type() in C:\xampp\htdocs\test-phundament\protected\modules\p3media\controllers\ImportController.php on line <i>231</i></th></tr>




Yeah, I also stumbled upon that … the function is deprecated, this is the hotfix :) Just include it “somewhere”.


if (!function_exists('mime_content_type ')) {

    function mime_content_type($filename) {

        $finfo    = finfo_open(FILEINFO_MIME);

        $mimetype = finfo_file($finfo, $filename);


        return $mimetype;




Hello Schmunk,

First of all I want to say what a good work you do, making a base for a CMS. It looks very nice!

I am very new at all of this; php, yii, phundament, … Hopefully my question will not sound too stupido and you can help me in the right direction. This is my first post here at the yii forum.

After installation of P3 I get an “error 500 Yiic command not found (./yiic)” clicking the Manage-link (h++p://localhost/phundament/p3admin/module?module=p3widgets)on the “Phundament 3 administration”-page. In fact the only Manage-link that doesn’t give me this error are the first (h++p://localhost/phundament/p3admin/module?module=p3admin) and the last one (h++p://localhost/phundament/p3admin/module?module=gii).

Is this the way it supposed to be or is this not right? Some help here will be apriciated very much.


  • Win7

  • apache

  • PHP 5.3

  • MySQL

The steps I took:

  1. extracted framework directory of yii-1.1.10 in same root folder as where phundament will be placed (htdocs/phundament)

  2. extracted phundament3 in htdocs/phundament

  3. setup MySQL database for p3

  4. commandline in Aptana: phundament/protected/setup-p3.sh phundament/framework/yiic

  5. step1 runs, no problems, webapp is made in htdocs/phundament

  6. before step 2 (db migration) I configure the protected/config/main.php file to use the MySQL database.

  7. run step 2 by typing ‘y’ at the commandline, migration runs fine

  8. run step 3 … , no problems!

  9. open webpage in browser, looks fine and most of all works also fine.

Installing rights can be a bitch, You have to create the tables in this order to prevent foreign keys errors:


//then I think the rest doesnt matter.

This is because authAssignment and others tries to put foreign keys to authItem. And if authItem doesnt exist… well there u have your error.

Re arrange the order the tables are written in the .sql file would solve this for everyone in the future:p