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?

Paul Wicks
  • 211
  • 2
  • 6

3 Answers3

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.

Paul Wicks
  • 211
  • 2
  • 6
  • 1
    how can i navigate to this directory? its not there in the FTP – Harsha M V Dec 31 '13 at 06:16
  • You should create a phprc file ...... http://wiki.dreamhost.com/PHP.ini#How_to_add_a_phprc_file ....... http://wiki.dreamhost.com/PHP.ini#Loading_PHP_Extensions ....... http://wiki.dreamhost.com/PHP.ini ...... – KeizerBridge Feb 27 '15 at 14:10
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
Dilantha
  • 41
  • 3
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.

David Spillett
  • 22,534
  • 42
  • 66