13

I have installed phalcon extension.It was installed successfully but the phalcon command not working. following Error shown.

"iMac:project Atomix$ phalcon -sh: phalcon: command not found"

I have Followed instruction from Phalcon official website.it works on windows and Linux perfectly but not in mac os.

Bipul Khan
  • 697
  • 1
  • 5
  • 10
  • I had some troubles with it on Linux. In my case the solution was to create the (automatically included) INI file `/etc/php5/mods-available/phalcon.ini` (with content `extension=phalcon.so`) manually and to enable it with a symlink: `ln -s /etc/php5/mods-available/phalcon.ini /etc/php5/fpm/conf.d/20-phalcon.ini`. – automatix Apr 21 '14 at 15:16

5 Answers5

10

Install Phalcon in Mac OS X from Scratch

Keep in mind that Phalcon is a PHP Framework that improves the power of PHP, it means that Phalcon needs an Apache Web Server running PHP and a couple things more. Also Phalcon provides a developer tools that help to create many things very faster.

Requirements:

  • Knowledge using the Terminal command line
  • Knowledge using .profile in mac
  • Knowledge using Apache Configurations
  • Knowledge in Web development

I am using Mac OS X El Capitan Version 10.11 (15A284)

  1. Step 1 Install XCode

    • Download XCode from App Store
    • Install XCode
    • NOTE: you not need a Developer Account for that
  2. Step 2 Install Command Line Developer Tools

    • Use your terminal commands line
    • Run the next command line: console$ xcode-select --install
  3. Step 3 Install Homebrew

  4. Step 4 Install PHP 5X (where X is the minor number version that you need 4, 5 or 6)

    • Run these commands lines
    • console$ brew tap homebrew/dupes
    • console$ brew tap homebrew/versions
    • console$ brew tap homebrew/homebrew-php
    • console$ brew tap homebrew/dupes
    • console$ brew install php5X
    • console$ brew install homebrew/php/php5X-mcrypt
  5. Step 5 Create your Sites folder in your user folder

    • Run these commands lines:
    • console$ mkdir ~/Sites
    • console$ echo "<?php phpinfo();" > ~/Sites/index.php
  6. Step 6 Create your Developer folder in your user folder

    • Run this command line :
    • console$ mkdir ~/Developer
  7. Step 7 Setup your Apache Web Server

    • Open your HTTPD.conf with your favorite Text Editor for example i use ATOM
    • Run this command line:
    • console$ sudo atom /etc/apache2/httpd.conf
    • In your httpd.conf search and uncomment that one
    • LoadModule rewrite_module libexec/apache2/mod_rewrite.so
    • Comment or delete this line (remember use # for comment)
    • LoadModule php5_module libexec/apache2/libphp5.so
    • Insert this new line
    • LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
    • Change this lines
    • User _www
    • Group _www
    • For these other
    • User your_username
    • Group staff
    • Change this lines too
    • DocumentRoot "/Library/WebServer/Documents"
    • <Directory "/Library/WebServer/Documents">
    • For these other
    • DocumentRoot "/Users/your_username/Sites"
    • <Directory "/Users/your_username/Sites">
    • Also change this line too
    • AllowOverride none
    • For this one
    • AllowOverride All
    • Run this command line to start apache server:
    • console$ sudo apachectl start
    • Run this command line to restart apache server:
    • console$ sudo apachectl restart
    • Run this command line to stop apache server:
    • console$ sudo apachectl stop
    • Test this in your favorite browser
    • http://localhost/
  8. Step 8 Setup your PHP ini

    • Open your php.ini (where X is the minor number version that you need)
    • Run this command line to open your php ini (I use atom, but you can use nano, sublime, etc):
    • console$ sudo atom /usr/local/etc/php/5.X/php.ini
    • go to your date.timezone and add the correct timezone, Mac OS X has not default setup for that
  9. Step 9 Installing MySQL

    • Download lastest version of MySQL Communiti Server from dev.mysql.com
    • Install the dmg file
    • Use this commands in command line to use your MySQL
    • console$ sudo /usr/local/mysql/support-files/mysql.server start
    • Use this commands in command line to set the root password
    • /usr/local/mysql/bin/mysqladmin -u root password 'yourpasswordhere'
  10. Step 10 Install GIT and your Profile file

    • Run this command line, to install GIT:
    • console$ brew install git
    • Create your .profile
    • console$ sudo atom ~/.profile
    • Add your the paths (I have my personal commands in ~/Developer/bin, but you can use whatever path for your personal commands)
    • export PATH=$PATH:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/opt/php56/bin:'~/Developer/bin
  11. Step 11 Finally Install Phalcon Framework

    • Run this command line to prepare phalcon package in your mac os x, (where X is the minor number version that you need):
    • console$ brew install php5X php5X-phalcon
    • Now you need to clone cphalcon code, you can do that in your favorite folder I prefer use my Developer folder in ~/Developer then run this command line, to clone the cphalcon code:
    • console$ git clone --depth=1 git://github.com/phalcon/cphalcon.git
    • Now go to cphalcon/build folder (in my case is ~/Developer/cphalcon/build), first go to the folder where you have your git clone and then run this command line, to go there:
    • console$ cd cphalcon/build
    • Now compile and install the cphalcon extension, for that run this command line:
    • console$ sudo ./install
    • Add the extension in your php ini file php.ini run this command line to open your php.ini (in my case i use atom but you can use your favorite text editor, and remember X is the minor number version of php):
    • console$ sudo atom /usr/local/etc/php/5.X/php.ini
    • Add the extension in your php.ini
    • extension=phalcon.so
    • Restart your Apache Web Server and open with your browser your localhost
  12. Step 12 Install Phalcon Developer tools

    • Clone the phalcon developer tools project from github, you can do that in your favorite folder, I have used my Developer folder in ~/Developer, so go to the folder of your choice and run this command:
    • console$ git clone https://github.com/phalcon/phalcon-devtools.git
    • Be shure that the folder is the right name phalcon-devtools, and run these commands (I use my Developer folder to clone my phalcon-devtools, but you can use your favorite folder), now run this command to create the link to execute:
    • ln -s ~/Developer/phalcon-devtools/phalcon.php /usr/local/sbin/phalcon
    • give the permisions with this command
    • chmod ugo+x /usr/local/sbin/phalcon
    • or Create your ~/Developer/bin folder add the link with this command:
    • ln -s ~/Developer/phalcon-devtools/phalcon.php /usr/local/bin/phalcon
    • and give the permisions to that folder:
    • chmod ugo+x ~/Developer/bin/phalcon
    • Test your phalcon developer tools running this command line
    • console$ phalcon commands

NOTE1: to activate your profile you need to run this command: console$ . ~/.profile

NOTE2: restart your apache server: console$ sudo apachectl restart

Well i know that is a lot maybe there is some mistakes but I try to cover everything from the scratch.

I hope that this post will be helpful.

toddsalpen
  • 411
  • 4
  • 9
0

Phalcon extension does not provide the phalcon command line utility. To get the phalcon command line utility you need to install Phalcon Developer Tools for Mac from this link below http://docs.phalconphp.com/en/latest/reference/mactools.html

0

Did you restart the webserver post installation?

Alternatively, it's easily installed on mac using homebrew:

$brew search phalcon
$brew install php56-phalcon
Hassan
  • 628
  • 5
  • 11
0

This is what I did to install Phalcon Developer-Tools for Mac 10.9:

Step 1
Using terminal, clone the devtools into your preferable location, I used the default document root.

$cd /Library/WebServer/Documents/
$git clone https://github.com/phalcon/phalcon-devtools.git

Step 2
Edit or create ~/.bash_profile if you don't have one.

export PTOOLSPATH=/Library/WebServer/Documents/phalcon-devtools
export PATH="$PTOOLSPATH:$PATH"

Step 3

$sudo ln -s /Library/WebServer/Documents/phalcon-devtools/phalcon.sh /Library/WebServer/Documents/phalcon-devtools/phalcon
$chmod +x /Library/WebServer/Documents/phalcon-devtools/phalcon

Please make sure you change all the path above (/Library/WebServer/Documents/) using yours.

Now try phalcon command again in the terminal. I hope it works :).

0

Phalcon is a great framework however support is wanting I ended up using this https://github.com/JohanSaltutti/php-phalcon-macos

to install on mac

Stephen Ngethe
  • 1,034
  • 13
  • 24