Phar extension is missing in DH's php 5.3


#1

Hello,

I’m using the latest version of Symfony (2.1.2) which now uses Composer (http://getcomposer.org/) to manage vendor applications and dependencies.

Composer requires the Phar extension to be installed in php. Luckily (most of the time) this extension comes built into php 5.3+ (http://php.net/manual/en/phar.installation.php). I’m running 5.3.13 on my domains.

Unfortunately, phar does not seem to be available in the dreamhost installation of php 5.3…

Running php -m in shell, returns the following:

$ php -m
[PHP Modules]
bcmath
calendar
ctype
curl
date
dom
exif
filter
ftp
gd
gettext
hash
iconv
imap
json
libxml
mbstring
mcrypt
mhash
mongo
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
posix
pspell
Reflection
session
SimpleXML
sockets
SPL
SQLite
standard
tokenizer
XCache
xml
xmlreader
xmlwriter
xsl
Zend Optimizer
zlib

[Zend Modules]
XCache
Zend Extension Manager
Zend Optimizer

Likewise, running this script returns ‘not found’:
[php]
if (!extension_loaded(‘Phar’)) {
echo “not found”;
}
[/php]

In phpinfo(), under Configure Command, ‘–enable-phar=shared’ is listed. I don’t know what that means exactly, but thought I would include it here…

Dreamhost support didn’t know what to do with this problem. I thought I could come here and see if anyone had any advice as to how I could install the extension on my own.

Thanks.


#2

DH support ended up providing me some hints as to how to enable the phar extension in php 5.3.
(Don’t know if this is only for VPS users).

For future reference:

  1. in shell, create the ~/.php/5.3 directory and then open a text editor to create the ~/.php/5.3/phprc file ($ vi ~/.php/5.3/phprc). See http://wiki.dreamhost.com/Php.ini#PHP_5.3.
  2. add this line: ‘extension = /usr/local/php53/lib/php/extensions/no-debug-non-zts-20090626/phar.so’
  3. save and close, and you’re done.

#3

That goes for all PHP 5.3 users — shared, VPS, and dedicated alike.

For what it’s worth, you should be able to abbreviate the “extension” line to simply:

As the path defaults to the system extension directory (/usr/local/php53/lib/php/extensions/no-debug-non-zts-20090626/).


#4

This post seems one of the most informative on this subject, however after I edited php.ini via ssh and rebooted my vps server, phpinfo() still does not show phar is installed.

I doubled checked php.ini and “extension = phar.so” is definitely there.

Anything else I can try? Thanks!!