• Home
  • About Us
  • Contact Us
  • Privacy Policy
  • Special Offers
Business Intelligence Info
  • Business Intelligence
    • BI News and Info
    • Big Data
    • Mobile and Cloud
    • Self-Service BI
  • CRM
    • CRM News and Info
    • InfusionSoft
    • Microsoft Dynamics CRM
    • NetSuite
    • OnContact
    • Salesforce
    • Workbooks
  • Data Mining
    • Pentaho
    • Sisense
    • Tableau
    • TIBCO Spotfire
  • Data Warehousing
    • DWH News and Info
    • IBM DB2
    • Microsoft SQL Server
    • Oracle
    • Teradata
  • Predictive Analytics
    • FICO
    • KNIME
    • Mathematica
    • Matlab
    • Minitab
    • RapidMiner
    • Revolution
    • SAP
    • SAS/SPSS
  • Humor

Tag Archives: Phalcon

Phalcon Working with Multi Modules

December 14, 2014   Mobile and Cloud

Phalcon Working with Multi Modules

Step 1:

kunal@kunal:/var/www/html/p/phalcon$ sh phalcondevtool/phalcon project multimod –type=modules

kunal@kunal:/var/www/html/p/phalcon$ cd multimod

kunal@kunal:/var/www/html/p/phalcon/multimod$ cd apps/

kunal@kunal:/var/www/html/p/phalcon/multimod/apps$ ls

frontend

Step 2:

kunal@kunal:/var/www/html/p/phalcon/multimod/apps$ cp -r frontend/ admin/

kunal@kunal:/var/www/html/p/phalcon/multimod/apps$ ls

admin  frontend

kunal@kunal:/var/www/html/p/phalcon/multimod/apps$ cd admin/

Step 3:

kunal@kunal:/var/www/html/p/phalcon/multimod/apps/admin$ sudo vi Module.php

In the above file make changes in namespace and in registerAutoloaders

namespace Multimod\Frontend;

Change to

namespace Multimod\Admin;

And

$  loader->registerNamespaces(array( 
            'Multimod\Frontend\Controllers' => __DIR__ . '/controllers/', 
            'Multimod\Frontend\Models' => __DIR__ . '/models/', 
));

Change to

$  loader->registerNamespaces(array( 
            'Multimod\Admin\Controllers' => __DIR__ . '/controllers/', 
            'Multimod\Admin\Models' => __DIR__ . '/models/', 
));

Step 4:

kunal@kunal:/var/www/html/p/phalcon/multimod/apps/admin$ cd controllers/

kunal@kunal:/var/www/html/p/phalcon/multimod/apps/admin/controllers$ sudo vi ControllerBase.php

In above file change the namespace.

namespace Multimod\Frontend\Controllers;
Change to

namespace Multimod\Admin\Controllers;

Step 5:

kunal@kunal:/var/www/html/p/phalcon/multimod/apps/admin/controllers$ sudo vi IndexController.php

In above file change the namespace.

namespace Multimod\Frontend\Controllers;
Change to

namespace Multimod\Admin\Controllers;

Step 6:

kunal@kunal:/var/www/html/p/phalcon/multimod/apps/admin$ sudo vi views/index/index.phtml

Add following line in above file to make sure that your admin view is different.

Congratulations! you are in admin view

Step 7:

kunal@kunal:/var/www/html/p/phalcon/multimod/config$ sudo vi modules.php

Add new register modules.

 'frontend' => array( 
        'className' => 'Multimod\Frontend\Module', 
        'path' => __DIR__ . '/../apps/frontend/Module.php' 
    )



Add new line below to this is as follow….

'admin' => array( 
        'className' => 'Multimod\Admin\Module', 
        'path' => __DIR__ . '/../apps/admin/Module.php' 
    )


Step 8:

kunal@kunal:/var/www/html/p/phalcon/multimod/config$ sudo vi services.php

You foud the default module is frontend so we need to add the routing for admin module. So here is the code.

$  router->add("/admin", array( 
                'module'     => 'admin', 
                'namespace'  => 'Multimod\Admin\Controllers', 
                'controller' => 'index', 
                'action'     => 'index', 
        ));

URL for front end : http://localhost/p/phalcon/multimod/

URL for Backend Admin : http://localhost/p/phalcon/multimod/admin

By Kunal Pingalkar|December 12th, 2014|Technology|0 Comments

Share This Story, Choose Your Platform!

  • Facebook

    Facebook

  • Twitter

    Twitter

  • LinkedIn

    LinkedIn

  • Reddit

    Reddit

  • Tumblr

    Tumblr

  • Google +1

    Google +1

  • Pinterest

    Pinterest

  • Email

    Email

About the Author: Kunal Pingalkar

 Phalcon Working with Multi Modules
Kunal Pingalkar has a total experience of 9 years with expertise in PHP, Ruby on Rails, MySQL, PgSL. Currently, he is working with PHP and Ruby on Rails. He came into the industry after completing his MS in Software Systems. Apart from computers, travelling and reading about tech trends interest him.

This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.
Want something else to read? How about ‘Grievous Censorship’ By The Guardian: Israel, Gaza And The Termination Of Nafeez Ahmed’s Blog

e-Zest | India | USA | UK | Germany | Europe

Read More

All about Phalcon: Part 1

December 11, 2014   Mobile and Cloud

All about Phalcon: Part 1

What is Phalcon?

Phalcon is not only a framework, it is a PHP5 extension written in ‘C’ language. But you do not need to learn or use the ‘C’ language. Phalcon is loosely coupled, allowing you to use it’s objects as a components based on your application needs.

What is framework?

A software framework is a universal, reusable software environment that provides particular functionality as part of a larger software platform to facilitate development of software applications, products and solutions. Frameworks offer a     structured philosophy to easily maintain projects writing less code and making work more fun.

Why Phalcon?

There are lots of PHP frameworks now a days. Almost all programmers prefer to use frameworks. Most of the functionality is already considered and tested in frameworks.

Internal working of PHP:

We all know that PHP is an interpreted language and not a compiled language. Every time a script is requested, it must be first interpreted. Syntax checking is performed every time for every file in the request. The major disadvantage is performance loss.

How other PHP frameworks work?

  • Many files, classes and functions are read every time request made.
  • Disk reading is expensive in terms of performance, especially when the file structure also includes deep folders.
  • Modern frame use lazy loading to increase performance, to handle the load and execute only the required code.
  • Some of these classes contain methods that aren’t used in every request but they are still loaded consuming memory.

How Phalcon works?

  • Phalcon loads together with PHP one time on the web server’s daemon start process.
  • Phalcon framework code isn’t interpreted because is already compiled to a specific platform and processor
  • There is no restriction while using Phalcon framework. You are free to use full framework or a single part of framework.
  • Interact with databases with maximum performance by using a C-language ORM for PHP.

How to setup Phalcon with Apache on Windows and Linux?

Window Environment:

First lets look into the Phalcon setup on Windows environment. It is very easy to setup Phalcon on the Windows environment. The only drawback is that you need to choose the right .dll file for your environment.

Here is the URL from which you can access all the Phalcon dll files:

http://phalconphp.com/en/download/windows

Now how to choose right Phalcon DLL file to download for your environment?

It’s very simple. Write a simple phpinfo file and check the PHP environment.

Following is the sample Code for : phpinfo.php file.

                             
phpinfo();                  
?>

After executing the above file in your browser, you will get the PHP environment details. Here is the sample screen from the beginning containing the information details.

PHP environment details All about Phalcon: Part 1

There are three factors involved while choosing the .dll file for download.

1. PHP version.

2. 2. Architecture.

3. 3. Compiler

In the above screen, the PHP version is 5.5.9, The Architecture is x86 and finally the Compiler is MSVC11 which is nothing but VC11. It might happen that you will not get the right file for your current PHP version, in that case you can choose the immediate lower version of the PHP and search for the dll files.

Syntax :

Phalcon 1.3.4 – Windows for PHP ()

Example :

Phalcon 1.3.4 – Windows x86 for PHP 5.5.0 (VC11)

Download the dll zip file and extract the file.

Step 1 – Copy the file php_phalcon.dll to the PHP extensions. If you have installed XAMPP in the c:\xampp folder, the extension needs to be in c:\xampp\php\ext

Step 2 – Edit the php.ini file, it is located at C:\xampp\php\php.ini. It can be edited with Notepad or a similar program. We recommend Notepad++ to avoid issues with line endings. Append at the end of the file: extension=php_phalcon.dll and save it.

Step 3 – Restart the Apache Web Server.

To validate whether Phalcon is up and installed successfully, again execute the phpinfo.php file in your browser and search for Phalcon. You may see the following screenshots.

Phalcon All about Phalcon: Part 1

Linux Environment:

Again, it is extremely easy to install Phalcon on the Linux environment.

Requirements:

You need following packages previously installed.

1. PHP 5.x development resources.

2. GCC Compiler.

Following are the commands as per O.S. to install the required packages.

#Ubuntu

sudo apt-get install php5-dev php5-mysql gcc libpcre3-dev

#Fedora

sudo yum install php-devel php-mysqlnd gcc libtool

#RHEL

sudo yum install php-devel php-mysql gcc libtool

#Suse

yast2 -i php5-pear php5-devel php5-mysql gcc

#OS X (Using Homebrew)

brew tap homebrew/dupes

brew tap homebrew/versions

brew tap homebrew/php

brew install php5x php5x-phalcon # Where “x” – minor number of PHP

First way to install Phalcon:

If you want to install Phalcon from the Ubuntu repository, here are three simple steps to install Phalcon:

1. sudo apt-add-repository ppa:phalcon/stable

2. sudo apt-get update

3. sudo apt-get install php5-phalcon

If you are missing the apt-add-repository run the following command:

sudo apt-get install python-software-properties

Compilation/Second way to install Phalcon (Preferred):

1. To create the extension from C source follow these steps:

git clone –depth=1 git://github.com/phalcon/cphalcon.git

cd cphalcon/build

sudo ./install

2. Add the extension to your php.ini:

extension=phalcon.so

3. Finally, restart the webserver

In compilation way we need to add the phalcon.ini file in the extension. How to create the ini file and where to keep the ini file is explained below:

After adding the extension in php.ini file, we need to create the ini file for Phalcon.

1. Check your extension directory & ini files directory

You might have found the following paths.

Extention dir path is : /usr/lib/php5/20121212

Ini files dir path is : /etc/php5/mods-available/

Now we need to go to the ini files dir path as like follow.

cd /etc/php5/mods-available/

Create a ini file there for Phalcon.

We have to create the file using other ini file.

You can use the following command.

sudo cp curl.ini phalcon.ini

Now we need to add/ modify the following line in the phalcon.ini file extension=/usr/lib/php5/20121212/phalcon.so

Again restart the Apache server.

sudo service apache2 restart

Check your phpinfo(). Phalcon is enabled there or it is not there. If you don’t find Phalcon, Execute the following command:

sudo ln -s /etc/php5/mods-available/phalcon.ini /etc/php5/apache2/conf.d/20-phalcon.ini

Above command creates the link of the phalcon.ini file.

Advantages and disadvantages of phalcon?

Sr. No. Advantages Disadvantages
1 Phalcon is an extension of PHP written in “C” language. You cannot deploy Phalcon project on shared hosting.
2 Framework code is already compiled. It is not a CMS with default login and registration functionality.
3 Request per second ratio much higher than other PHP frameworks. No Official IDE Support.
4 Performance of Phalcon is much higher than other PHP frameworks. No Multiversion support.

How to install phalcon developer tools.

There are two ways to install Phalcon developer tools.

1. Using composer.

Install composer in a common location or in your project:

curl -s http://getcomposer.org/installer | php

Create the composer.json file as follows:

{
  "require": {
      "phalcon/devtools": "dev-master"
        }
}

Run the composer installer:

php composer.phar install

Create a symbolic link to the phalcon.php script:

ln -s ~/devtools/phalcon.php /usr/local/bin/phalcon

chmod ugo+x /usr/bin/phalcon

2. Manual installation.

sudo git clone git://github.com/phalcon/phalcon-devtools.git phalcondevtool

cd phacondevtool

sudo sh ./phalcon.sh

ln -s ~/phacondevtool/phalcon /usr/local/bin/phalcon

chmod ugo+x /usr/local/bin/phalcon

More in the next part

References:

http://docs.phalconphp.com/en/latest/reference/motivation.html

By Kunal Pingalkar|December 11th, 2014|Technology|0 Comments

Share This Story, Choose Your Platform!

  • Facebook

    Facebook

  • Twitter

    Twitter

  • LinkedIn

    LinkedIn

  • Reddit

    Reddit

  • Tumblr

    Tumblr

  • Google +1

    Google +1

  • Pinterest

    Pinterest

  • Email

    Email

About the Author: Kunal Pingalkar

 All about Phalcon: Part 1
Kunal Pingalkar has a total experience of 9 years with expertise in PHP, Ruby on Rails, MySQL, PgSL. Currently, he is working with PHP and Ruby on Rails. He came into the industry after completing his MS in Software Systems. Apart from computers, travelling and reading about tech trends interest him.

This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.
Want something else to read? How about ‘Grievous Censorship’ By The Guardian: Israel, Gaza And The Termination Of Nafeez Ahmed’s Blog

e-Zest | India | USA | UK | Germany | Europe

Read More
  • Recent Posts

    • SO MUCH FOR GLOBAL WARMING, EH?
    • Important Changes to Microsoft Dynamics 365 Field Service Mobile App
    • Syncing Dynamics 365 User Permissions with SharePoint
    • solve for variable in iterator limit
    • THE UNIVERSE: A WONDROUS PLACE
  • Categories

  • Archives

    • January 2021
    • December 2020
    • November 2020
    • October 2020
    • September 2020
    • August 2020
    • July 2020
    • June 2020
    • May 2020
    • April 2020
    • March 2020
    • February 2020
    • January 2020
    • December 2019
    • November 2019
    • October 2019
    • September 2019
    • August 2019
    • July 2019
    • June 2019
    • May 2019
    • April 2019
    • March 2019
    • February 2019
    • January 2019
    • December 2018
    • November 2018
    • October 2018
    • September 2018
    • August 2018
    • July 2018
    • June 2018
    • May 2018
    • April 2018
    • March 2018
    • February 2018
    • January 2018
    • December 2017
    • November 2017
    • October 2017
    • September 2017
    • August 2017
    • July 2017
    • June 2017
    • May 2017
    • April 2017
    • March 2017
    • February 2017
    • January 2017
    • December 2016
    • November 2016
    • October 2016
    • September 2016
    • August 2016
    • July 2016
    • June 2016
    • May 2016
    • April 2016
    • March 2016
    • February 2016
    • January 2016
    • December 2015
    • November 2015
    • October 2015
    • September 2015
    • August 2015
    • July 2015
    • June 2015
    • May 2015
    • April 2015
    • March 2015
    • February 2015
    • January 2015
    • December 2014
    • November 2014
© 2021 Business Intelligence Info
Power BI Training | G Com Solutions Limited