Cannot start fpm using phpbrew on Ubuntu

2019-08-15 03:23发布

问题:

I have installed phpbrew and its dependencies, however I am having trouble testing fpm using the stated command:

phpbrew switch 5.4.38
sudo phpbrew fpm start
Did you mean 'app'? [Y/n] n
Command fpm not found. available commands are: help, zsh, bash, meta, compile, archive, github:build-topics, app, init, known, install, list, use, switch, each, config, info, env, extension, variants, path, cd, download, clean, update, ctags, list-ini, self-update, remove, purge, off, switch-off
Command: command not found

obviously I have gone wrong somewhere but cannot find why it will not fire up. I can confirm it is there

cd ~/.phpbrew/php/php-5.4.38/sbin
ls
php-fpm

Install command:

phpbrew install 5.4.38 +fpm +mysql;

Info:

Version PHP-5.4.38

Constants PHP Prefix: /home/datamechanics/.phpbrew/php/php-5.4.38 PHP Binary: /home/datamechanics/.phpbrew/php/php-5.4.38/bin/php PHP Default Include path: .: PHP Include path: .:

General Info

phpinfo()
PHP Version => 5.4.38

System => Linux dmdell02 4.2.0-16-generic #19-Ubuntu SMP Thu Oct 8 15:35:06 UTC 2015 x86_64
Build Date => Mar 10 2016 15:29:28
Configure Command =>  './configure'  '--prefix=/home/datamechanics/.phpbrew/php/php-5.4.38' '--with-config-file-path=/home/datamechanics/.phpbrew/php/php-5.4.38/etc' '--with-config-file-scan-dir=/home/datamechanics/.phpbrew/php/php-5.4.38/var/db' '--disable-all' '--enable-phar' '--enable-session' '--enable-short-tags' '--enable-tokenizer' '--with-pcre-regex' '--with-zlib=/usr' '--with-libdir=lib/x86_64-linux-gnu' '--enable-fpm' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--enable-dom' '--enable-libxml' '--enable-simplexml' '--enable-xml' '--enable-xmlreader' '--enable-xmlwriter' '--with-xsl' '--with-libxml-dir=/usr'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /home/datamechanics/.phpbrew/php/php-5.4.38/etc
Loaded Configuration File => /home/datamechanics/.phpbrew/php/php-5.4.38/etc/php.ini
Scan this dir for additional .ini files => /home/datamechanics/.phpbrew/php/php-5.4.38/var/db
Additional .ini files parsed => (none)
PHP API => 20100412
PHP Extension => 20100525
Zend Extension => 220100525
Zend Extension Build => API220100525,NTS
PHP Extension Build => API20100525,NTS
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => disabled
Zend Memory Manager => enabled
Zend Multibyte Support => disabled
IPv6 Support => enabled
DTrace Support => disabled

Registered PHP Streams => compress.zlib, php, file, glob, data, http, ftp, phar
Registered Stream Socket Transports => tcp, udp, unix, udg
Registered Stream Filters => zlib.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

Extensions
Core, date, ereg, libxml, pcre, zlib, dom, SPL, session, standard, Reflection, mysqlnd, SimpleXML, Phar, mysqli, tokenizer, xml, xmlreader, xmlwriter, xsl, mysql

Database Extensions
mysqlnd
mysqli
mysql

回答1:

If you've installed phpbrew iteslf using sudo that wont help. phpbrew relies on getPhpbrewHome function everywhere.

Unless you explicitly define PHPBREW_HOME with PHPBREW_HOME=/blah phpbrew ... it will use your HOME environment variable to generate installation/execution paths. But running sudo overrides HOME unless you tell it to preserve environment with -E: env |grep HOME => /home/vagrant, sudo env |grep HOME => HOME=/root, sudo -E env |grep HOME => HOME=/home/vagrant.

In other words it searches for php binaries in /home/datamechanics/.phpbrew/ when you run it as regular user and in /home/root/.phpbrew/if you run it with sudo

Most likely you have 3 option to solve your issue:

  1. install php using sudo sudo phpbrew install 5.4.38 +fpm +mysql
  2. run phpbrew fpm with your current user
  3. explicitly set PHPBREW_HOME while running it with sudo sudo PHPBREW_HOME=/home/datamechanics/.phpbrew phpbrew fpm start


回答2:

Done with all this trying to use OSX as a dev server.

Now using PHPStorm and pure VirtualBox Ubuntu server install. Price for personal PHPStorm and its features is amazing. Community support also.

Tried Vagrant but its crap and the fact it bodges DNS and port forwarding is not a proper representation of a remote host - we want to test as much as possible on modelled servers or real ?

Therefore the answer is to view both Windows and OSX unable to provide industry webserver config, and install a virtual machine with Linux as the server.

I now edit with PHPStorm on shared directory with VM, using the Zero Configuration facility bookmarklets in Chrome to debug PHP.

This is turning into a perfect dev setup on board an OSX laptop (my main aim) but can be used anywhere as all GIT based.

Happy to provide hints, but considered this question answered by me.