I get an error when trying to use artisan command tinker. For example I would like to add a user. In my terminal I type
$ php artisan tinker
Sometimes pcntl functions are disabled in some distros, so you have to
Find your cli's php.ini
file
php --ini
Edit it that php.ini
, usually you'll have to do
sudo gedit /etc/php5/cli/php.ini
or
sudo vim /etc/php5/cli/php.ini
and comment a line that starts with
; disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,...
You don't really have to comment it all, you can just enable pcntl functions, by removing them from that line, but if this is a development box, you can just enable everything.
One or more of readline
posix
and pcntl
extensions are missing.
You need to compile PHP with the appropiate configuration options to enabled it.
Here are the instructions:
Note that posix functions are enabled by default.
I personally use MAMP and also rely on MAMP's version of PHP for the CLI. When I hit this issue I found that the Redline and PCNTL extensions were not part of MAMP's PHP distribution.
I wrote an article on how I fixed the problem as well as a link to download the two extensions that I had to compile from source.
http://adampatterson.ca/blog/2014/10/laravel-tinker-boris-mamp-os-x-yosemite/
If you are on debian like me this should work:
source: http://pkgs.org/debian-wheezy/dotdeb-i386/php5-readline_5.4.28-1~dotdeb.1_i386.deb.html
Add the following line to /etc/apt/sources.list:
deb http://packages.dotdeb.org/ wheezy all
Install GPG key of the repository:
wget http://www.dotdeb.org/dotdeb.gpg
sudo apt-key add dotdeb.gpg
Update the package index:
sudo apt-get update
Install php5-readline deb package:
sudo apt-get install php5-readline