如何在mac os中安装phalcon.so [英] how to install phalcon.so in mac os
问题描述
我已经安装phalcon扩展。它安装成功,但phalcon命令不工作。
以下错误显示。
iMac:project Atomix $ phalcon
-sh:phalcon:command not found
我有Phalcon官方网站的跟随指令。在Windows和Linux上完美工作,但不是在mac os。
在Mac OS X中从头开始安装Phalcon
$ b请记住,Phalcon是一个PHP框架,提高了PHP的功能,这意味着Phalcon需要一个Apache Web服务器运行PHP和一些事情。
要求:
- 使用Terminal命令行的知识
- 在
mac中使用.profile的知识 - 使用Apache配置的知识
- Web中的知识
开发
我使用Mac OS X El Capitan版本10.11 )
-
步骤1安装XCode
- 从 App Store 下载XCode
- 安装XCode
- 注意:您不需要开发人员帐户
-
步骤2安装命令行开发工具
- 使用终端命令行
- 运行下一个命令行:
console $ xcode-select --install
-
步骤3安装Homebrew
- 使用您的终端命令行
- 命令行:
console $ ruby -e$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )
- 运行以下命令行:
console $ brew doctor
- 运行以下命令行:
console $ brew update
-
步骤4安装PHP 5X(
-
$ b - code> 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在用户文件夹中创建您的Sites文件夹
- 运行以下命令行:
-
console $ mkdir〜/ Sites
-
console $ echo<?php phpinfo >〜/ Sites / index.php
-
步骤6在您的用户
- 运行此命令行:
-
console $ mkdir〜开发人员
-
步骤7设置Apache Web服务器
- 使用您喜爱的文本编辑器打开HTTPD.conf,例如我使用ATOM
- 运行此命令行:
-
console $ sudo atom /etc/apache2/httpd.conf
- 在您的httpd.conf搜索和取消注释一个
-
LoadModule rewrite_module libexec / apache2 / mod_rewrite.so
- (记住使用#作为注释)
-
LoadModule php5_module libexec / apache2 / libphp5.so
- 插入新行
-
LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
- 更改此行
用户_www
Group _www
- 对于这些其他
用户your_username
小组人员
- 更改此行
DocumentRoot/ Library / WebServer / Documents
WebServer / Documents>
- 对于这些其他
DocumentRoot/ Users / your_username /网站
- 也更改此行
AllowOverride none
AllowOverride All
- 运行此命令行启动apache服务器:
console $ sudo apachectl start
- 运行此命令行重新启动apache服务器:
console $ sudo apachectl restart
- 运行此命令行停止apache服务器:
console $ sudo apachectl stop
- 在您喜爱的浏览器中测试此
- http:// localhost /
-
步骤8设置PHP ini
- 打开php.ini(,其中X是次要版本您需要)
- 运行此命令行打开您的php ini(我使用atom,但您可以使用nano,sublime等):
-
console $ sudo atom /usr/local/etc/php/5.X/php.ini
- 转到您的date.timezone并添加正确的时区,Mac OS X没有默认设置
- p>步骤9安装MySQL
- 从 dev.mysql.com
- 安装dmg文件
- 使用此命令在命令行中使用您的MySQL
-
console $ sudo /usr/local/mysql/support-files/mysql.server start
/ li>
- 在命令行中使用此命令设置根密码
-
/ usr / local / mysql / bin / mysqladmin -u root密码'yourpasswordhere'
-
步骤10安装GIT和您的个人资料文件
- 运行此命令行以安装GIT:
-
console $ brew install git
- 创建您的.profile
-
console $ sudo atom〜/ .profile
- 添加您的路径(我在〜/ Developer / bin中有我的个人命令,但您可以为您的个人命令使用任何路径)
-
export PATH = $ PATH:/ usr / local / sbin:/ usr / local / mysql / bin:/ usr / local / opt / php56 / bin: 〜/ Developer / bin
-
步骤11最后安装Phalcon框架
- 运行此命令行以在mac os x,
()中准备phalcon软件包,其中X是您需要的次要版本号): -
console $ brew install php5X php5X-phalcon
- 克隆cphalcon代码,你可以在你最喜欢的文件夹中,我喜欢在〜/ Developer中使用我的Developer文件夹,然后运行这个命令行,克隆cphalcon代码:
-
console $ git clone --depth = 1 git://github.com/phalcon/cphalcon.git
- 现在转到cphalcon / build文件夹在我的情况是〜/ Developer / cphalcon / build),首先去到你有你的git克隆的文件夹,然后运行这个命令行,去那里:
-
console $ cd cphalcon / build
- 现在编译并安装cphalcon扩展,为此运行此命令行:
-
console $ sudo ./install
- 在php ini文件中添加扩展名php.ini
运行此命令行打开你的php.ini(在我的case我使用atom,但你可以使用你最喜欢的文本编辑器,并记住X是php 的次要版本): -
console $ sudo atom /usr/local/etc/php/5.X/php.ini
- 添加扩展在您的php.ini中
-
extension = phalcon.so
- 重新启动Apache Web Server并使用您的浏览器打开本地主机
- 运行此命令行以在mac os x,
-
步骤12安装Phalcon开发人员工具
- 从github克隆phalcon开发人员工具项目,您可以在您最喜欢的文件夹中,我使用〜/ Developer中的我的Developer文件夹,所以转到您选择的文件夹并运行此命令:
-
console $ git clone https://github.com/phalcon/phalcon-devtools.git
- 确定文件夹是正确的名称phalcon-devtools ,然后运行这些命令(我使用我的Developer文件夹克隆我的phalcon-devtools,但您可以使用您最喜欢的文件夹),现在运行此命令创建要执行的链接:
-
ln -s〜/ Developer / phalcon-devtools / phalcon.php / usr / local / sbin / phalcon
- 给出此命令的授权
-
chmod ugo + x / usr / local / sbin / phalcon
- 或创建〜/ Developer / bin文件夹
使用此命令添加链接: -
ln -s〜/ Developer / phalcon -devtools / phalcon.php / usr / local / bin / phalcon
- 并授予该文件夹的权限:
-
chmod ugo + x〜/ Developer / bin / phalcon
- 测试运行此命令行的phalcon开发人员工具
-
console $ phalcon commands
$ b b
注意1:要激活您的配置文件,您需要运行以下命令:
console $。 〜/ .profile
注意:重新启动apache服务器:
console $ sudo apachectl restart
我知道这很可能是有一些错误,但我试图覆盖从头开始的一切。
我希望这篇文章是有帮助的。
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.
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)
Step 1 Install XCode
- Download XCode from App Store
- Install XCode
- NOTE: you not need a Developer Account for that
Step 2 Install Command Line Developer Tools
- Use your terminal commands line
- Run the next command line:
console$ xcode-select --install
Step 3 Install Homebrew
- Use your terminal commands line
- Run this command line:
console$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Run this command line:
console$ brew doctor
- Run this command line:
console$ brew update
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
Step 5 Create your Sites folder in your user folder
- Run these commands lines:
console$ mkdir ~/Sites
console$ echo "<?php phpinfo();" > ~/Sites/index.php
Step 6 Create your Developer folder in your user folder
- Run this command line :
console$ mkdir ~/Developer
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/
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
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'
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
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
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.
这篇关于如何在mac os中安装phalcon.so的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!