Skip to main content

Posts

Showing posts from 2012

The requested URL /phpmyadmin was not found on this server.

Problem:

localhost/phpmyadmin

Not Found The requested URL /phpmyadmin was not found on this server.
Apache/2.2.22 (Ubuntu) Server at localhost Port 80Solution:

PhpMyAdmin, by default, writes an alias in a file /etc/phpmyadmin/apache.conf



Open and edit your apache2.conf

sudo gedit /etc/apache2/apache2.conf

Into the file write:

       Include /etc/phpmyadmin/apache.conf

Save the file.
Restart your apache.

    sudo service apache2 restart 

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

Problem:

user@localhost:~$ sudo service apache2 restart

 * Restarting web server apache2                                           
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName


Solution:

Open and edit your apache.conf

sudo gedit /etc/apache2/apache.conf

Into the file write on top:

ServerName localhost

Save the file.

Restart your apache.


sudo /etc/init.d/apache2 restart or sudo service apache2 restart




Another way is open edit  your hosts

sudo gedit /etc/hosts



127.0.0.1 localhost 127.0.1.1 ubuntu #your hostname 127.0.0.1 server.domain.com #your local ip and domain name 192.168.1.1 server.domain.com #your network card Internal IP address and domain name 202.123.123.123 server.domain.com #your external/Public IP address and domain name Save the file.

Restart your network.

sudo /etc/init.d/networkin…

Install CakePHP 2.x in Ubuntu

Requirements:

HTTP Server. For example: Apache. mod_rewrite is preferred, but by no means required.PHP 5.2.8 or greater.Database Engine (MySQL (4 or greater), PostgreSQL, Microsoft SQL Server, SQLite) Download CakePHP 2.x at their website: http://cakephp.org/

Extract your downloaded file.

Copy and paste the contents of the Cake archive in /var/www/cakephp

Make it writable, open your terminal and type:

    sudo chmod 777 -R /var/www/cakephp

Create your database.

Goto /var/www/cakephp/app/Config/ and rename your database.php.default to database.php.

Open database.php, then just replace the values in the $default array with those that apply to your setup. . A sample completed configuration array might look something like the following:

<?phppublic$default=array('datasource'=>'Database/Mysql','persistent'=>false,'host'=>'localhost','port'=>'','login'=>'DatabaseUsername','password'=>'Datab…

ACL 2.2.0 Plugin for CakePHP 2.2.3

This plugin is such an interface allowing to manage permissions of your application's users and roles.

1. Download latest CakePHP latest stable in CakePHP.org.

2. Install CakePHP see how: Install CakePHP 2.x in Ubuntu.

3. Setup a Simple Acl Controlled Application follow instruction here : Simple  Acl Controlled Application , part 1 only.

4. Download ACL Plugin for CakePHP 2.2

ACL Plugin Installation

copy the folder acl in your folder /app/pluginsconfigure the admin route (see http://book.cakephp.org/2.0/en/development/routing.html#prefix-routing)copy the parameters found in Acl/Config/bootstrap.php in your file /app/Config/bootstrap.php or load the plugin with its own bootstrap.php file CakePlugin::load('Acl', array('bootstrap' => true)); see more: ACL Plugin Installation

 5. In your bootstrap.php located in your cakefolder/app/Plugin/Acl/Config/bootsrap.php. If you use groups (if you use database in in simple acl controlled application)  change 'Role&#…

CakePHP: GET Current Controller, Action and Parameters

We will have the following url:

                      http://sherwinrobles.blogspot.com/users/view/1/2/3

To get the current controller:

echo $this->params['controller'];
Output:
        users


To get the current action:

echo $this->action;
Output:
        view


To get the first parameter:

echo $this->params['pass'][0];
Output:
        1

To get the second parameter:

echo $this->params['pass'][1];
Output:
        2

To get the first parameter:

echo $this->params['pass'][2];
Output:
        3

and so on...







CakePHP : Accessing the logged in user

Once a user is logged in, you will often need some particular information about the current user. You can access the currently logged in user using AuthComponent::user(). This method is static, and can be used globally after the AuthComponent has been loaded. You can access it both as an instance method or as a static method:

You can access all the user's information(fields) from the users table except the password.

<?php // Use anywhere  // Accesing user’s id AuthComponent::user('id');                                                                
$_SESSION['Auth']['User']['id'];
// Accesing user’s username AuthComponent::user('username');                                                                
$_SESSION['Auth']['User'