Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

--enable-phar=shared Do I have to recompile PHP to Install Composer?

I am trying to get Composer installed on a DreamHost VPS

Linux 3.1.9-vs2.3.2.5vs2.3.2.5+

Web PHP Version 5.4.11

CLI Version PHP 5.4.11 (cli)

phpinfo() output has only one reference to phar and it says --enable-phar=shared but when I attempt the following the output says I need phar enabled.

sudo -u myuser curl -sS https://getcomposer.org/installer | /usr/local/php54/bin/php
#!/usr/bin/env php
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:

The phar extension is missing.
Install it or recompile php without --disable-phar

Do I have to recompile PHP to get par extension enabled?

Here is the whole current configure command

'./configure' '--prefix=/usr/local/php54' '--datadir=/usr/local/php54/share' '--localstatedir=/usr/local/php54/var' '--without-pear' '--with-config-file-path=/etc/php54' '--with-config-file-scan-dir=/etc/php54/conf.d' '--with-zend-vm=GOTO' '--enable-cgi' '--enable-fpm' '--enable-libxml=shared' '--enable-bcmath=shared' '--enable-calendar=shared' '--enable-ctype=shared' '--enable-dom=shared' '--enable-exif=shared' '--enable-fileinfo=shared' '--enable-filter=shared' '--enable-ftp=shared' '--enable-hash=shared' '--enable-intl=shared' '--enable-json=shared' '--enable-mbstring' '--enable-mbregex' '--enable-mbregex-backtrack' '--enable-pcntl=shared' '--enable-pdo' '--enable-phar=shared' '--enable-posix=shared' '--enable-session=shared' '--enable-shmop=shared' '--enable-simplexml=shared' '--enable-soap=shared' '--enable-sockets=shared' '--enable-sysvmsg=shared' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--enable-tokenizer=shared' '--enable-wddx=shared' '--enable-xml=shared' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--enable-zip=shared' '--with-openssl=shared' '--with-kerberos' '--with-pcre-regex' '--with-sqlite3' '--with-zlib=shared' '--with-bz2=shared' '--with-curl=shared' '--with-gd=shared' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-zlib-dir=/usr' '--with-xpm-dir=/usr' '--with-freetype-dir=/usr' '--with-gettext=shared' '--with-gmp=shared' '--with-mhash=shared' '--with-iconv=shared' '--with-imap=shared' '--with-imap-ssl' '--with-ldap=shared' '--with-mcrypt=shared' '--with-msql=shared' '--with-mysql=shared,mysqlnd' '--with-mysql-sock=/No-MySQL-hostname-was-specified' '--with-mysqli=shared,mysqlnd' '--with-pdo-mysql=shared,mysqlnd' '--with-pdo-pgsql=shared' '--with-pdo-sqlite' '--with-pgsql=shared' '--with-pspell=shared' '--with-readline=shared' '--with-tidy=shared' '--with-xmlrpc=shared' '--with-xsl=shared'

EDIT

From the command line running

sudo -u myuser /usr/local/php54/bin/php -i > ~/phpinfo.txt

Gives same phar setting:

PHP Version => 5.4.11

System => Linux ps29943 3.1.9-vs2.3.2.5vs2.3.2.5+ #3 SMP Wed Feb 12 13:51:29 PST 2014 x86_64
Build Date => Feb  5 2013 18:44:25
Configure Command =>  './configure'  '--prefix=/usr/local/php54' '--datadir=/usr/local/php54/share' '--localstatedir=/usr/local/php54/var' '--without-pear' '--with-config-file-path=/etc/php54' '--with-config-file-scan-dir=/etc/php54/conf.d' '--with-zend-vm=GOTO' '--enable-cgi' '--enable-fpm' '--enable-libxml=shared' '--enable-bcmath=shared' '--enable-calendar=shared' '--enable-ctype=shared' '--enable-dom=shared' '--enable-exif=shared' '--enable-fileinfo=shared' '--enable-filter=shared' '--enable-ftp=shared' '--enable-hash=shared' '--enable-intl=shared' '--enable-json=shared' '--enable-mbstring' '--enable-mbregex' '--enable-mbregex-backtrack' '--enable-pcntl=shared' '--enable-pdo' '--enable-phar=shared' '--enable-posix=shared' '--enable-session=shared' '--enable-shmop=shared' '--enable-simplexml=shared' '--enable-soap=shared' '--enable-sockets=shared' '--enable-sysvmsg=shared' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--enable-tokenizer=shared' '--enable-wddx=shared' '--enable-xml=shared' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--enable-zip=shared' '--with-openssl=shared' '--with-kerberos' '--with-pcre-regex' '--with-sqlite3' '--with-zlib=shared' '--with-bz2=shared' '--with-curl=shared' '--with-gd=shared' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-zlib-dir=/usr' '--with-xpm-dir=/usr' '--with-freetype-dir=/usr' '--with-gettext=shared' '--with-gmp=shared' '--with-mhash=shared' '--with-iconv=shared' '--with-imap=shared' '--with-imap-ssl' '--with-ldap=shared' '--with-mcrypt=shared' '--with-msql=shared' '--with-mysql=shared,mysqlnd' '--with-mysql-sock=/No-MySQL-hostname-was-specified' '--with-mysqli=shared,mysqlnd' '--with-pdo-mysql=shared,mysqlnd' '--with-pdo-pgsql=shared' '--with-pdo-sqlite' '--with-pgsql=shared' '--with-pspell=shared' '--with-readline=shared' '--with-tidy=shared' '--with-xmlrpc=shared' '--with-xsl=shared'
Server API => Command Line Interface
like image 422
jerrygarciuh Avatar asked Feb 13 '23 06:02

jerrygarciuh


2 Answers

From what I understand reading about similar problems, that missing extension error should go away when you actually include that extension in your php.ini.

First of all, scan for an existing file phar.so - it should be around /usr/local/php54/lib or so.

Then check if there are any traces of configuration that just waits to be enabled in /etc/php54/conf.d. After that, and nothing was found that looks like being connected to phar, check the /etc/php54/php.ini in the [extension] section. There might be a line commented out that contains something like this: extension = phar.so. Activate it.

After that, php -m should give you a list of activated extentions including the phar one. There is no need to restart PHP on the command line, because there is no persistent process that needs a restart.

If this all fails, you probably have to accept "yes" as an answer to "Must I recompile?", but I doubt your installed PHP comes without the shared extensions .so files. And even if not, it's probably easier to install a missing package containing that extension.

like image 131
Sven Avatar answered Feb 15 '23 20:02

Sven


Ubuntu 16.04 ++

sudo apt install composer 
like image 32
gilcierweb Avatar answered Feb 15 '23 19:02

gilcierweb