Install Phalcon on MAMP PRO 4 (OS X Sierra + Homebrew) - macos

I'd like to start to use Phalcon on my server but I'm getting some issue installing it on MAMP PRO.
1) The server is running PHP 7.1 located in /Applications/MAMP/bin/php/php7.1.1
1.1) on terminal:
php -v return
PHP 7.1.1 (cli) (built: Jan 23 2017 15:09:57) ( NTS )
2) inside this directory I created a subdirectory /include/php and here here I downloaded the content of http://php.net/get/php-7.1.6.tar.bz2/from/a/mirror
3)
cd /Applications/MAMP/bin/php/php7.1.1/include/php
3.1)
./configure --without-iconv
3.2) I got "Thank you for using PHP"
4) From info listed here Phalcon:install (OSX + Brew )
# OS X (Homebrew)
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/php
brew install php7x php7x-phalcon
5) Compiling Phalcon as
git clone --depth=1 git://github.com/phalcon/cphalcon.git
cd cphalcon/build
sudo ./install
Then I got: Thanks for compiling Phalcon!
6) Now I have to tell to server to use the new extension so I created a info php page to get the right place to update php.ini
<?php
echo php_ini_loaded_file();
phpinfo();
?>
and it says...
Library/Application Support/appsolute/MAMP PRO/conf/php.ini
...
PHP Version 7.1.1
...
7) Finally on terminal I update the php.ini
sudo vi /Library/Application Support/appsolute/MAMP PRO/conf/php.ini
I got an empty file (!) so I try to load the php7.1.1.ini and it it's full so I add at last line
extension=phalcon.so
8) restart the server ( to be sure I restart MAMP PRO)
But it doesn't works... reloading the phpinfo() Phalcon is missing... and if I go on my Phalcon pages I got
Fatal error: Uncaught Error: Class 'Phalcom\Config' not found
If I run
php -v
I got this warning:
Warning: PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php/php7.1.1/lib/php/extensions/no-debug-non-zts-20160303/phalcon.so' - dlopen(/Applications/MAMP/bin/php/php7.1.1/lib/php/extensions/no-debug-non-zts-20160303/phalcon.so, 9): image not found in Unknown on line 0
PHP 7.1.1 (cli) (built: Jan 23 2017 15:09:57) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
But if I comment the last line in php.ini the warning disappear.
Can you help me to understand what's wrong ?
Thanks :)

You can to build by hand. Just git clone cphalcon:
$ php -v
PHP 7.1.5 (cli) (built: May 13 2017 13:30:32) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
$ ls -al /usr/local/bin/phpize
lrwxr-xr-x 1 sergheiiakovlev admin 35 May 16 15:07 /usr/local/bin/phpize -> ../Cellar/php71/7.1.5_17/bin/phpize
$ ls -al /usr/local/bin/php-config
lrwxr-xr-x 1 sergheiiakovlev admin 39 May 16 15:07 /usr/local/bin/php-config -> ../Cellar/php71/7.1.5_17/bin/php-config
$ cd build
$ ./install
$ php --ri phalcon
phalcon
Web framework delivered as a C-extension for PHP
phalcon => enabled
Author => Phalcon Team and contributors
Version => 3.2.0
Build Date => Jun 21 2017 20:33:47
Powered by Zephir => Version 0.9.9-868cb1f92b
Directive => Local Value => Master Value
phalcon.db.escape_identifiers => On => On
phalcon.db.force_casting => Off => Off
phalcon.orm.events => On => On
phalcon.orm.virtual_foreign_keys => On => On
phalcon.orm.column_renaming => On => On
phalcon.orm.not_null_validations => On => On
phalcon.orm.exception_on_failed_save => Off => Off
phalcon.orm.enable_literals => On => On
phalcon.orm.late_state_binding => Off => Off
phalcon.orm.enable_implicit_joins => On => On
phalcon.orm.cast_on_hydrate => Off => Off
phalcon.orm.ignore_unknown_columns => Off => Off
phalcon.orm.update_snapshot_on_save => On => On
phalcon.orm.disable_assign_setters => Off => Off

Related

The composer install command gives illegal offset type error

When I run the composer install command on my laravel project, I get this error:
> #php artisan package:discover --ansi
ErrorException : Illegal offset type
at /var/www/routes/web.php:57
56| $blah = app('config')->get('app.api_content_type_map');
> 57| $bb = $blah[$lang];
Exception trace:
1 Illuminate\Foundation\Bootstrap\HandleExceptions::handleError()
/var/www/routes/web.php:57
2 Illuminate\Routing\RouteFileRegistrar::{closure}()
/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php:414
Please use the argument -v to see more details.
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
I have this in my config/app.php
'api_content_type_map' => [
'en'=>[
'news'=>'article',
'page'=>'page'
],
'fr'=>[
'nouvelles'=>'article',
'page'=>'page'
]
],
What did I do wrong?
UPDATE 1
This is the output of my php -v
PHP 7.4.2 (cli) (built: Jan 23 2020 11:21:30) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.2, Copyright (c), by Zend Technologies
UPDATE 2
I deleted line 57, php artisan config:clear, add back the line,composer install, and still get the same error message. I went to another computer, did a fresh checkout of the project, tried to runcomposer install`, also the same error. So I'm thinking it's not actually some cache issue?

voyager - (Symfony\Component\Console\Exception\CommandNotFoundException] There are no commands defined in the "voyager" namespace)

So I am trying to install Voyager for my laravel, but when I insert
php artisan voyager:install
I am getting this error message:
(Symfony\Component\Console\Exception\CommandNotFoundException] There
are no commands defined in the "voyager" namespace)
Here is my PhP and Laravel version:
Laravel Framework version 5.3.16
λ php -v PHP 7.0.13 (cli) (built: Nov 8 2016 13:45:28) ( ZTS )
Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright
(c) 1998-2016 Zend Technologies
And my package service providers:
/*
* Package Service Providers...
*/
TCG\Voyager\VoyagerServiceProvider::class,
Intervention\Image\ImageServiceProvider::class,
So what is the problem? why am I getting this error message
Looks like you didn't install it. Comment out or remove service providers from the list and run these commands:
composer require tcg/voyager
composer dumpauto
According to the docs, next step will be adding a service provider to the config/app.php:
TCG\Voyager\VoyagerServiceProvider::class,
And only then run php artisan voyager:install command.
php artisan config:clear
solved my problem
If you have successfully executed the command line:
composer require tcg/voyager
You must have the line "tcg/voyager": "^1.2" in the require section of your composer.json file, in this case the command line "composer dumpautoload" will automatically perform all the packages discovery for you. Otherwise do the following :
add the line of code: TCG\Voyager\VoyagerServiceProvider::class to the file "config/app.php". Then run the following command line :
composer dumpautoload

how to install mongo.so for PHP7 on OSX ElCapitan

I am running OSX 10.11.3
PHP 7.0.2 (cli) (built: Jan 8 2016 10:14:20) ( NTS )
after executing
sudo pecl install mongodb
I do have an error:
Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php56/5.6.16/lib/php/extensions/no-debug-non-zts-20131226/mongodb.so' - dlopen(/usr/local/Cellar/php56/5.6.16/lib/php/extensions/no-debug-non-zts-20131226/mongodb.so, 9): Symbol not found: _zval_used_for_init
Referenced from: /usr/local/Cellar/php56/5.6.16/lib/php/extensions/no-debug-non-zts-20131226/mongodb.so
Expected in: flat namespace
in /usr/local/Cellar/php56/5.6.16/lib/php/extensions/no-debug-non-zts-20131226/mongodb.so in Unknown on line 0
How to fix this problem?
you could have a try to config php.ini with extension = mongodb.so, if not, maybe due to version match question.

Composer: The requested package php could not be found

Every time i try and run composer install, the dependencies fail due to the following error:
The requested package php could not be found
I've got this working on a LAMP stack, but I'm trying to get it working on a LEMP stack now, with php5-fpm and its not going well.
$ php -v
PHP 5.5.8-3+sury.org~precise+2 (cli) (built: Jan 29 2014 13:23:55)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
EDIT
I have other stuff in mine, but i tested the following composer.json on the same server, and its still doing it.
composer.json
{
"require": {
"php": "5.4.*"
}
}
my composer version is
Composer version b7a9ea4187bce63f418bf7ba035b63dcb1e23ef6 2014-02-06 22:07:47
Am I missing something?
Well, that's easy: Composer is exactly doing what you tell it to do.
You are requesting any version of PHP 5.4. You explicitly do not allow any versions of 5.5. So Composer correctly complains about having not the right version of PHP (yours is PHP 5.5, you request 5.4.*).
It is very unlikely that your code does not run with the newer version, so it's best to use this composer.json content:
{
"require": {
"php": ">=5.4"
}
}
Requesting a version greater than or equal 5.4 will also include 5.5 and above.

PHPUnit instllation broken since Mountain Lion upgrade

I upgraded my Mac from Lion to Mountain Lion a few months ago.
I previously had PHPUnit working with my Zend Framework 1.11 without issue but had not used it much.
I now have Zend Framewoprk 2 running on a Quick Start website but I simply cannot gwet PHPUnit to work.
I've searched numerous questions related to this on Stackoverflow and tried reinstalls and path changes to php.ini without success.
I have also checked that my PEAR install is working fine, which it is but the error is the same when I try "phpunit --version"
PHP Warning: require(/usr/lib/php/PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 43
Warning: require(/usr/lib/php/PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 43
PHP Fatal error: require(): Failed opening required '/usr/lib/php/PHPUnit/Autoload.php' (include_path='.:/Users/johnadmin/pear/share/pear/PEAR:/Users/johnadmin/pear/share/pear:/usr/bin/phpunit:/Users/johnadmin/pear/share/pear/PHPUnit:/usr/bin/phpunit:/Users/johnadmin/pear/bin/pear') in /usr/bin/phpunit on line 43
Fatal error: require(): Failed opening required '/usr/lib/php/PHPUnit/Autoload.php' (include_path='.:/Users/johnadmin/pear/share/pear/PEAR:/Users/johnadmin/pear/share/pear:/usr/bin/phpunit:/Users/johnadmin/pear/share/pear/PHPUnit:/usr/bin/phpunit:/Users/johnadmin/pear/bin/pear') in /usr/bin/phpunit on line 43
Attempts to reinstall phpunit results in me been told phpunit is already installed and its version current.
$ sudo pear install phpunit/PHPUnit
phpunit/PHPUnit is already installed and is the same as the released version 3.7.10
install failed
Trying to uninstall fails as phpunit is a dependancy in other items/applications.
Is there anyway I can fix this or completely remove it and reinstall fresh?
include_path in my php.ini is:
include_path=".:/Users/johnadmin/pear/share/pear/PEAR:/Users/johnadmin/pear/share/pear:/usr/bin/phpunit:/Users/johnadmin/pear/share/pear/PHPUnit:/usr/bin/phpunit:/Users/johnadmin/pear/bin/pear"
Additional info in case its relevant:
> which phpunit
/usr/bin/phpunit
> which pear
/Users/johnadmin/pear/bin/pear
> which php
/usr/bin/php
Autoload.php is located in
/Users/johnadmin/pear/share/pear/PHPUnit
Additionally, the folder '/usr/lib/php/' exists but the PHPUnit directory is not under that, it is under /Users/johnadmin/pear/share/pear/PHPUnit
bash_profile content/paths
PATH=$PATH:/usr/local/Cellar/imagick/3.0.1:/usr/local/sbin:/Users/johnadmin/pear/share/pear:$
##
# Your previous /Users/johnadmin/.bash_profile file was backed up as /Users/johnadmin/.bash_$
##
# MacPorts Installer addition on 2012-04-17_at_08:37:29: adding an appropriate PATH variable$
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
##
# Your previous /Users/johnadmin/.bash_profile file was backed up as /Users/johnadmin/.bash_$
##
# MacPorts Installer addition on 2012-10-09_at_16:09:32: adding an appropriate PATH variable$
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
##
# Your previous /Users/johnadmin/.bash_profile file was backed up as /Users/johnadmin/.bash_$
##
# MacPorts Installer addition on 2012-12-06_at_13:40:25: adding an appropriate PATH variable$
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
At my wits end as I do not know what else to check frankly and any help would be a big help. Ta
John
Nevermind after hours of trying various solutions I found that creating a simlink to the PHPUnit folder worked.
Command I used was
sudo ln -s /Users/johnadmin/pear/share/pear/PHPUnit /usr/lib/php/PHPUnit
Seriously, this helped me a lot:
Install Composer (http://getcomposer.org)
composer require phpunit/phpunit 3.7.*
composer update
Three simple steps to pull PHPUnit source, and binary to your project.

Resources