4

So, i'm trying to use Silex on my dreamhost account and I'm getting an error

Fatal error: Class 'Phar' not found in blah blah blah...

when I try to include the Silex.phar file. When I look at phpinfo(), there isn't a section for Phar, even though everything I've seen claims that Phar support should be included by default in php 5.3.whatever, which is what i'm running under. Any Ideas?

3 Answers 3

7

Figured it out. If you add a directory at ~/.php/5.3/ and then put a file called phprc in it with the following line in it

extension=phar.so

then the phar extension gets loaded.

2
4

I found you have to put some more lines in the phprc file for it to work in FastCGI mode

extension=phar.so
detect_unicode = Off
phar.readonly = Off
phar.require_hash = Off
suhosin.executor.include.whitelist = phar
0

You will generally not be able to enable/disable things in the PHP configuration on a shared host. There are a number of things that can often be tweaked with settings in .htaccess files depending on your host's setup, but enabling modules/libraries is not one of them.

Most hosts do not run entirely with the default PHP options for one reason or another, so even though it is included by default in the standard distribution you can not rely on finding in included on any given host.

You need to contact your host. They may be willing to enable the feature for you if it is something that might be useful to their customers more generally, or it may be something they already have enabled on some hosts (but have more rolled out to all yet) in which case they could move your account to a server that has it already.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .