how to install phalcon.so in mac os - php

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.

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

Did you restart the webserver post installation?
Alternatively, it's easily installed on mac using homebrew:
$brew search phalcon
$brew install php56-phalcon

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 :).

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

Related

Error installing php 71 with homebrew on my mac

I have been developing with Vallet for some time now. Today i wanted to update laravel 5.4 to 5.5. Before doing so i run composer global update. Causing Vallet to stop working.
Fist i tried to do the following:
cd ~/.composer/
sudo chown -R $(whoami) vendor
source: https://laracasts.com/discuss/channels/general-discussion/getting-valet-not-found-error
I did not solve the issue. Then i decided to reinstall Vallet. Hereby i did the following:
I followed this: https://github.com/laravel/valet/issues/321
Stop and uninstall services
sudo brew services stop php71 dnsmasq nginx
brew uninstall php71 dnsmasq nginx
Remove related config files and valet home folder
sudo rm -r /usr/local/etc/php /usr/local/etc/nginx /usr/local/etc/dnsmasq.conf
sudo rm -r ~/.valet /var/root/.valet
Install services i tried this:
brew install php71
$ brew tap homebrew/php
$ brew install php71
brew install homebrew/php/php71
All gave the following error:
MacBook-Pro:~ mblivier$ brew install homebrew/php/php71
==> Installing php71 from homebrew/php Error: The following formula: php71
cannot be installed as a binary package and must be built from source.
Install the Command Line Tools:xcode-select --install
I new in this and don't know how to solve this. Any suggestions how to install php and go further with reinstalling Vallet?
homebrew is installed and working
You need xcode to build php, so first run:
xcode-select --install
to install xcode and later you can brew install php71
This is answer for your comment, I can't post as comment, need to post because is length limited.
There is one of two things going on here, either you didn't install PHP, or PHP is installed and not currently in any of system aware paths. First I would try to find PHP and make sure it exists:
$ find / -name php -type f
You should see something like:
/path/to/your/php/bin/php
If PHP binary does exist, check your path:
$ echo $PATH
If it does not exist, recompile php.
If PHP exists on your system, make sure the path to the /bin/php file is included. You can edit your ~/.bash_profile and add the custom path like this:
PATH=$PATH:/path/to/your/php/bin/
....
export PATH
Then save and reload the file to ensure your current session has access to new path changes:
$ source ~/.bash_profile
With any luck you can now do a php -v and see the version response.

brew link php71: Could not symlink sbin/php-fpm

I'm trying to install Laravel Valet, which requires php 7.1, but when i run brew install php71, I get the following error:
==> Pouring php71-7.1.10_21.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink sbin/php-fpm
/usr/local/sbin is not writable.
I get the same error when i run brew link php71. If i run php -v, I actually see that I'm currently running PHP 7.1.7.
But when I run valet install, I get:
[DomainException]
Unable to determine linked PHP.
I don't even have an sbin directory in /usr/local.
Any suggestions?
I solved this problem by first creating the directory sbin:
sudo mkdir /usr/local/sbin
then if you are like me using macOS highSierra 10+ you need to run:
sudo chown -R $(whoami) $(brew --prefix)/sbin
after this
brew link php
Installing Laravel Valet, I had a similar issue with sbin not being writable. I had to make the directory, then utilized the solution included at this page. This finally allowed me the proper permissions to run a brew link command with a previously installed version of php 7.1.

How to run composer on MAMP 's php version?

I can't run composer install because my php's version on my OS is not enough updated (5.5.36). So i tried to install composer globally with my MAMP's php(5.6.10)
1) I create alias for my MAMP's php
nano ~/.bash_profile
alias phpmamp='/Applications/MAMP/bin/php/php5.6.10/bin/php'
2) Run this line to install composer
curl -sS https://getcomposer.org/installer | phpmamp
3) Run this line to move composer
sudo mv composer.phar /usr/local/bin/composer
Composer is installed (run composer on terminal works)
This is a the tutorial.
But when i want to run composer install, composer uses my OS php.
Any idea ?
Those lines worked for me. I override the OS PHP path to my MAMP PHP path.
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
$ export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH
$ source ~/.bash_profile
You can check the version by running :
$ which php
The complete solution
Thanks to #Andrew Patton
This is an old question, but it came up in web search for a similar issue I was having, and the latest version of MAMP Pro (mine is 6.6.2) has a GUI solution:
In Languages > PHP, under 'Default version', you should see a checkbox for "Also activate shortcut for Composer".
What this did for me is add an alias of composer=/Applications/MAMP/bin/php/composer (in my zshell ~/.profile file on macOS Monterey). Maybe yours works similarly.
Of course, when switching PHP versions, it wouldn't also switch composer versions (which is necessary when switching between PHP 5 and 7.2.5+), so I have to use the OS install for one version and MAMP's for another. A little tricky, but if you don't have this problem, then the alias will be fine.

How do I uninstall a PHP module?

I bumped into this bit of instructions while installing an addon for a PHP framework:
Make sure you don't have the PHP module installed. This is a Debian/Ubuntu example:
sudo apt-get purge php5-geoip
I am working on Windows PC with a Virtual Machine running Laravel Homsetead. I am using Git Bash command window. When I enter the above command I get:
bash: sudo: command not found
If I remember correctly, sudo is an Apple-related command so I tried dropping it like this:
apt-get purge php5-geoip
but I get
bash: apt-get: command not found
What command do I need to use to purge php5-geoip?
EDIT: echo $PATH gives out:
$ echo $PATH
/c/Users/Arthur/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/
bin:/c/Users/Arthur/bin:/c/ProgramData/Oracle/Java/javapath:/c/Windows/system32:
/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/
c/Program Files (x86)/Intel/OpenCL SDK/2.0/bin/x86:/c/Program Files (x86)/Intel/
OpenCL SDK/2.0/bin/x64:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c
/Program Files/MATLAB/MATLAB Production Server/R2015a/runtime/win64:/c/Program F
iles/MATLAB/MATLAB Production Server/R2015a/bin:/c/Program Files/MATLAB/MATLAB P
roduction Server/R2015a/polyspace/bin:/c/Program Files (x86)/Skype/Phone:/c/PHP:
/c/ProgramData/ComposerSetup/bin:/c/Users/Arthur/AppData/Roaming/Composer/vendor
/bin:/c/HashiCorp/Vagrant/bin:/c/Program Files/nodejs:/c/Users/Arthur/AppData/Ro
aming/npm:/usr/bin/vendor_perl:/usr/bin/core_perl

How do I install Pdftk on my server?

I am using a Linux Server and am trying to install Pdftk, but I am problems trying to figure out what exactly to do.
I found the following documentation on how to install it, but they refer mostly to installing it on the local Windows machine.
They are:
http://www.andrewheiss.com/blog/2009/07/29/installing-pdftk-php/
http://www.accesspdf.com/pdftk/#packages
Can someone help me unserstand exactly what files I need to place where on my server so I can refer to pdftk?
Pdftk is a version of iText which has been converted from Java to c++ and rebuilt with a command-line bridge for easy access from PHP applications.
To build pdftk on Redhat / CentOS please follow the below instructions.
ssh [server to install pdftk on]
Now that we are in the server we need to create the directories to store pdftk.
cd /
sudo mkdir extra
cd extra
sudo mkdir src
cd src
sudo wget http://www.pdfhacks.com/pdftk/pdftk-1.41.tar.gz
sudo tar zxvf pdftk-1.41.tar.gz
cd pdftk-1.41/pdftk
Now we need to install the gcj libraries.
sudo yum install java-1.4.2-gcj-compat-devel.i386
The gcc-c++ library doesn't get installed with the gcj package so we will install it now, so we don't get an error halfway through the compile process.
sudo yum install gcc-c++
If you compile the application right now you will receive a warning that tmpnam is dangerous to use and you should use mkstemp.
sudo vi report.cc
Run this from inside VI to do a search and replace for the tmpnam method.
:%s/tmpnam(/mkstemp(/g
Press escape and save the changes with
:wq!
Now that we have all the packages installed, we are going to start compiling pdftk-1.41
from /extra/src/pdftk-1.41/pdftk run the following command
sudo make -f Makefile.RedHat
This will kick off the build process for compiling and converting the java file to c++. This could take SEVERAL minutes to convert iText to c++. Go grab yourself a margarita from our new margarita machine in the break room :).
Now with the pdftk file created we will want to copy it to the /bin directory so that we can run it from anywhere.
sudo cp pdftk /usr/local/bin
Let's make sure the build was successful and run
pdftk --version
As of 2020, things are different now. CentOS 6 is stepping out and pdftk can only support CentOS 5/6. GCJ on CentOS 7 is removed, so installing from source is not easy too. But we have docker now:
FROM centos:centos6
RUN yum install -y https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-1.el6.x86_64.rpm
Then build with docker build . -t pdftk and run as:
docker run -it --rm -v $PWD:/data --workdir /data pdftk pdftk ./input.pdf output ./output.pdf
The example above can repair a pdf file missing a dozen of KB of data if you are lucky.
As mentioned by #rsc, pdftk-java will be available for Rocky Linux, but currently (2021.10.28), still cannot install it via yum.
Fortunately, there is a built command for x86_64 GNU/Linux systems, which does not require any runtime dependencies. So we can use it as follows
# the version number might be updated, check https://gitlab.com/pdftk-java/pdftk
wget https://gitlab.com/pdftk-java/pdftk/-/jobs/1527259632/artifacts/raw/build/native-image/pdftk
chmod +x pdftk
./pdftk ...
It works well in the server with the following system info,
$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: Rocky
Description: Rocky Linux release 8.4 (Green Obsidian)
Release: 8.4
Codename: GreenObsidian
As of 2021, there is pdftk-java: A port of the original GCJ-based PDFtk to Java, which is currently on the way to the repositories for Fedora 33+ and EPEL 7+ (latter for CentOS, RHEL or Rocky), allowing yum install pdftk-java to succeed (once the package reached the stable repositories).
Edit: The pdftk-java package is in the stable repositories since yesterday, 2021-10-29.

Categories