Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Phalcon with MAMP #13

Open
ninjapanzer opened this issue Jan 23, 2020 · 3 comments
Open

Install Phalcon with MAMP #13

ninjapanzer opened this issue Jan 23, 2020 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@ninjapanzer
Copy link
Contributor

MAMP contains its own packaged PHP so we need to add the extension to this context in order for MAMP to have access.

@ninjapanzer ninjapanzer self-assigned this Jan 23, 2020
@ninjapanzer ninjapanzer added the documentation Improvements or additions to documentation label Jan 23, 2020
@ninjapanzer
Copy link
Contributor Author

PECL is installed with the MAMP version so the following incantation should be close to universal:

Install against MAMP php with pecl

/Applications/MAMP/bin/php/php<version>/bin/pear install phalcon

Caveats

Due to the limitations of an unpaid MAMP we will have to manually edit the php.ini as well via CLI

This comes with some caveats as some options in the interface interfere with what php ini the binary has access to.

Screen Shot 2020-01-23 at 11 53 38 AM

Warning

If the option Make this version available on the command line then an alias is added to your ~/.profile for php which will move the ini temporarily to the /Library/applicationsupport if it is then deselected this will delete those files. Making it probably hard to maintain a custom configuration.

Register extensions by hand

As stated above the non paid version of MAMP will show you the php.ini if you click the -> next to the version but will not save it.

So we need to do this by hand.
Thankfully we have a somewhat generic incantation to get there

If you don't have a preference of text editor

$ open -a TextEdit /Applications/MAMP/bin/php/php<version>/conf/php.ini

Otherwise just edit this file using whatever you like

/Applications/MAMP/bin/php/php<version>/conf/php.ini

The order of extensions usually matters so search this file for
extension= until you see a block a little something like this

extension=imap.so
extension=gettext.so
extension=pgsql.so
extension=pdo_pgsql.so

Phalcon requires PDO so the safest way to register the phalcon and psr extensions installed by PECL is to add them to the bottom of the list of extensions eg.

extension=imap.so
extension=gettext.so
extension=pgsql.so
extension=pdo_pgsql.so

extension=psr.so
extension=phalcon.so

Warning

lines that start with ; are not parsed when PHP reads this file

@nabiguzel
Copy link

nabiguzel commented Jan 29, 2020

After your last update I successfully intsalled with brew

brew tap phalcon/extension https://github.com/phalcon/homebrew-tap brew install phalcon
this run gave some output and that output was ending like:

`==> psr@74
To finish installing psr for PHP 7.4:

  • /usr/local/etc/php/7.4/conf.d/ext-psr.ini was created,
    do not forget to remove it upon extension removal.
  • Validate installation via one of the following methods:
  • Using PHP from a webserver:
    • Restart your webserver.
    • Write a PHP page that calls "phpinfo();"
    • Load it in a browser and look for the info on the psr module.
    • If you see it, you have been successful!
  • Using PHP from the command line:
    • Run php -i "(command-line 'phpinfo()')"
    • Look for the info on the psr module.
    • If you see it, you have been successful!
      ==> phalcon@4.0.3
      To finish installing phalcon for PHP 7.4:
  • /usr/local/etc/php/7.4/conf.d/ext-phalcon.ini was created,
    do not forget to remove it upon extension removal.
  • Validate installation via one of the following methods:
  • Using PHP from a webserver:
    • Restart your webserver.
    • Write a PHP page that calls "phpinfo();"
    • Load it in a browser and look for the info on the phalcon module.
    • If you see it, you have been successful!
  • Using PHP from the command line:
    • Run php -i "(command-line 'phpinfo()')"
    • Look for the info on the phalcon module.
    • If you see it, you have been successful!
      `

After that;

I checked active Mamp PHP version with linking
http://localhost/MAMP/index.php?language=English&page=phpinfo
and get php.ini path then opened it and added psr.so path from "/usr/local/etc/php/7.4/conf.d/ext-psr.ini" and phalcon.so path form "/usr/local/etc/php/7.4/conf.d/ext-phalcon.ini" to end of my php.ini

`
[psr]
extension="/usr/local/opt/psr@74/psr.so"

[phalcon]
extension="/usr/local/opt/phalcon@4.0.3/phalcon.so"
`

@ninjapanzer ninjapanzer reopened this Jan 29, 2020
@ninjapanzer
Copy link
Contributor Author

Reopened because this looks like another use case where #8 matters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants