getting "command not found: phalcon" after successfully installing phalcon/devtools via composer - command-line

Software: MacOS
Phalcon: 5.0.0RC4
Phalcon/Devtools: 4.2.0
I have newly created phalcon 5.0 repository.
I successfully ran
composer install
composer require phalcon/devtools
however when I try to run a phalcon command I get
zsh: command not found: phalcon
I checked if it had installed successfully and tried reinstalling as well.
php -m returns that phalcon is installed too:
php -m | grep phalcon
phalcon
and the extension is there in the php.ini file
extension="phalcon.so"
Am I missing anything?

The phalcon/devtools package links the phalcon.php executable to your composer bin-dir.
Get it as follows:
composer config bin-dir
It defaults to ./vendor/bin. The installed symlink is ./vendor/bin/phalcon.php.
You can run the command as follows:
./vendor/bin/phalcon.php [..]
To ease access you can automatically add ./vendor/bin to your PATH (i.e. with direnv)
# .envrc
PATH_add ./vendor/bin
or you can create a ./bin dir in your project directory and symlink phalcon.php as phalcon into it.
mkdir ./bin
ln -sfn ./vendor/bin/phalcon.php ./bin/phalcon
Now you can add ./bin to your PATH:
export PATH="${PWD}/bin:${PATH}"
And invoke the phalcon CLI with:
phalcon [..]

Adding to Nicolai's answer, it is also possible to just call phalcon like so:
vendor/bin/phalcon commands
In my case, I didn't want to be able to call phalcon globally so I copied the file into the project directory and named it phalcon4
Then I edited the paths inside the file like so
$addpath = '/vendor/phalcon';
$GLOBALS['_composer_bin_dir'] = __DIR__ .$addpath;
$GLOBALS['_composer_autoload_path'] = __DIR__ .$addpath. '/..'.'/autoload.php';
// the rest of the code
include __DIR__ .$addpath. '/..'.'/phalcon/devtools/phalcon';
Now I can run the command like this:
php phalcon4 commands
Still, devtools 4.2 cannot run with phalcon 5 so the command just threw an error.

Related

How to enable pcntl extensions in MAMP pro?

I am using laravel/horizon with Osx MAMP pro
when I run the composer it requires laravel/horizon:~1.0
it shows a message -
laravel/horizon v1.0.8 requires ext-pcntl * -> the requested PHP
extension pcntl is missing from your system.
I checked the folder /Applications/MAMP/bin/php7.1.1/php/ext,it doesn't contain pcntl extension.
How can I install that?
download php from http://www.php.net/releases/
tar -xzvf php-7.2.1.tar.gz
cd php-7.2.1/ext/pcntl
/Applications/MAMP/bin/php/php7.2.1/bin/phpize
as # drewjoh metioned ./configure --with-php-config=/Applications/MAMP/bin/php/php7.2.1/bin/php-config --prefix=/Applications/MAMP/bin/php/php7.2.1/bin/php
make && make install
the terminal shows
Installing shared extensions: /Applications/MAMP/bin/php/php7.2.1/lib/php/extensions/no-debug-non-zts-20170718/
open MAMP PRO menu->File ->Edit Template->PHP->7.2.1 add extension=pcntl.so at the end of the php.ini file .
run the command php --ri pcntl and shows
pcntl pcntl support => enabled
Just an addition. Perhaps you followed the above step and still can't get it installed to /Applications/MAMP/bin/php/php7.2.1/lib/php/extensions/no-debug-non-zts-20170718/. Here is something I did that worked for me.
I added the --with-php-config before the --prefix flag and it worked. See step below.
download your MAMP php version from http://www.php.net/releases/ Mine is php7.2.22
Open your terminal and cd into your download folder. Then run this command to decompress the tar.gz file
tar -xzvf php-7.2.22.tar.gz
Cd into the pcntl directory after decompressing.
cd php-7.2.22/ext/pcntl
Run the next line from your terminal to Configure for PHP Api, Zend Module Api, and Zend Extension Api.
/Applications/MAMP/bin/php/php7.2.22/bin/phpize
Then run
./configure --with-php-config=/Applications/MAMP/bin/php/php7.2.22/bin/php-config --prefix=/Applications/MAMP/bin/php/php7.2.22/bin/php; make && make install;
You should see
Installing shared extensions: /Applications/MAMP/bin/php/php7.2.22/lib/php/extensions/no-debug-non-zts-20170718/
Then you can repeat the last two steps above.
You can download the precompiled extensions from here https://github.com/khanakiaphp/mamp_extensions

CMake install directory permission

I have built a project using cmake (LLVM project) and tried to install it by issuing the following command:
$ cmake3 --build . --target install
If I run it using root then there is no problem and the files will be installed under the directory /usr/local/.
My problem is when I want to install the project using normal user.
I get the following error:
CMake Error at cmake_install.cmake:36 (file):
file INSTALL cannot set permissions on "/usr/local/include/llvm"
I have changed the permission of directory /usr/local/ to 777 recursively, and their ownership to root:wheel and I added my normal user to group wheel. But I still cannot install the files into the /usr/local/ directory.
The main issue is about building project in Eclipse which fails at "Build Install" command.
chmod 777 -R / is a very scary command. I've destroyed a system once by doing that.
The philosophy I use for this is:
If I need to deploy something through my IDE to debug or test before packaging, I deploy it locally within my home directory.
I only install stuff to my system (outside of home) if it has been packaged first (*.deb, *.rpm, *.tar.gz) so that I can remove it without problems.
For me, I do this with:
cmake $src
cmake --build . --target install -- DESTDIR=stage
This will configure my project, make it, then install it locally in a folder called ./stage which resides in my build directory. I can then run my executable from ./stage/usr/bin. Note that this only works if make is your generator.
Once I've tested it and I'm happy, I package it and deploy to my system or upload to a repository:
cpack
sudo dpkg -i <package>.deb
We should use USE_SOURCE_PERMISSIONS in our install function.
Example:
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Release/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" USE_SOURCE_PERMISSIONS)

I can not create a lumen project

I have just installed composer and I have added this path where it is "~/.composer/vendor/bin" to my $PATH in OSX. But when I try this in terminal: >lumen new blog I get "-bash: lumen: command not found".
Any idea please?
I have created the project with this other command "composer create-project --prefer-dist laravel/lumen first app" but I don't know why I can not execute the lumen command

Problems running init as part of yii 2 install

I am installing yii 2 on a mac. I have mamp pro (3.0.7.3 latest) when i go to the command line and run.
php init i get a message saying
The mcrypt PHP extension is required by Yii2.
I checked the server using phpinfo() and it shows mcypt enabled. I checked the php.ini and it is listed and the file exists in the referenced directory.
any ideas anyone ??
This probably means that your php CLI (Command Line Interface) does not use the same php.ini than MAMP. You could use something like php -c /path/to/mamp/php.ini to be sure to use the same php.ini.
Or try the following command : php --ini, this will show you configuration file names, e.g. :
Configuration File (php.ini) Path: /path/to/php/conf
Loaded Configuration File: (none)
You could then make a symbolic link :
cd /path/to/php/conf
sudo ln -s /path/to/mamp/php.ini php.ini

Install ionic framework.

I have installed the module with node version v0.10.22
sudo npm install -g ionic
But know when I am trying to start an new application I am getting a
-bash command not found
which ionic
gives me nothing, do I have to add the path to on the $PATH variable ?
How did you installed npm? If you used homebrew then npm won't put npm files accessible by users.
Add export PATH=/usr/local/share/npm/bin:$PATH to your .bashrc/.bash_profile/.zshrc file and it should work fine.
Also refer this: Bower: "command not found" after installation