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 80       Solution: 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 na

Install CakePHP 4.x in Ubuntu

Image
Installation CakePHP has a few system requirements: HTTP Server. For example: Apache. Having mod_rewrite is preferred, but by no means required. You can also use nginx, or Microsoft IIS if you prefer. Minimum PHP 7.2 ( 8.1  supported). mbstring PHP extension intl PHP extension SimpleXML PHP extension PDO PHP extension In XAMPP, intl extension is included but you have to uncomment  extension=php_intl.dll  (or  extension=intl ) in  php.ini  and restart the server through the XAMPP Control Panel. In WAMP, the intl extension is “activated” by default but not working. To make it work you have to go to php folder (by default)  C:\wamp\bin\php\php{version} , copy all the files that looks like  icu*.dll  and paste them into the apache bin directory  C:\wamp\bin\apache\apache{version}\bin . Then restart all services and it should be OK. While a database engine isn’t required, we imagine that most applications will utilize one. CakePHP supports a variety of database storage engines: MySQL (5.6

ACL 2.2.0 Plugin for CakePHP 2.2.3

Image
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/plugins configure 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 controlle

CakePHP: GET Current Controller, Action and Parameters

Image
Request Parameters To get the current controller: $controllerName = $this -> request -> getAttribute ( 'controller' ); To get the current action: $acctionName = $this -> request -> getAttribute ( 'action' ); To get all passed arguments as a numerically indexed array: http :// localhost / calendars / view / recent / mark $parameters = $this -> request -> getParam( 'pass' ); Array ( [ 0 ] => recent [ 1 ] => mark ) Query String Parameters // URL is /posts/index?page=1&sort=title $page = $this -> request -> getQuery ( 'page' );

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' ][' username ']; // Accesing user’s group_id AuthComponent :: user ( 'group_id' );