TurnKey Linux Virtual Appliance Library

Adding PHP Extensions to LAMP Stack

I need to add an extension to the php configuration.  I can easily add it to the php.ini file, but I can not for the life of me find where the extension directory for the php extensions is.  I looked in the php.ini file, but the directive for directory extension is commented out.  However, if I look in the /etc/php5/conf.d directory, I see a series of ini file, each loading the module with nothing more than the extension= syntax.  So where are those so's on the filesystem?  the mysql.so?  the gd.so?  

Thanks

Jeremy's picture

Best to check if it's packaged first

As that's the best (safest, most predictable and most secure) way of installing. You can find out if it's been packaged a few different ways.

You can search online via http://packages.debian.org (it defaults to seaching package names only, but you can select to search descriptions as well) or you can do a quick search by including the search term in the url e.g to search for all packages that include php5 in the package name: http://packages.debian.org/php5

Another way that you can search for packages is at the commandline, like this:

apt-get update
apt-cache --names-only search php5

Again this example uses php5 as the search term. Note that by default (without the --name-only switch) apt-cache search searches descriptions as well as names.

Assuming that you find the extension you are after then just install with:

apt-get update
apt-get install <packagename>

Note that generally apt-get update is only needed once each session (unless you change the repos).

Failing all that you can find where a file/folder is using the find command, like this:

find / -name '<file/folder-name>'

Syntax of find is find [path] [options]. You can also use wildcards (*) in the name. As an example, to find mysql.so:

 

find / -name 'mysql.so'

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)