# PHP Extension - newbie question

- Thread: https://externals.io/message/22441
- Original archive: https://news-web.php.net/php.internals/22441
- Started by George McLachlan on 2006-03-15T02:02:25+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #22441 — George McLachlan — 2006-03-15T02:02:25+00:00

URL: https://externals.io/message/22441#22441

Hi,
      I have been lurking on this list for a while, and this is my first 
post. Sorry it has to be such a daft question.  I don't even know if 
it's the right list, so my apologies in advance.

  I need to add mysqli support to a web server and our sys admin refuses 
to do anything unless it comes from a debian package. Anyway I thought 
it would be possible to compile PHP in a chroot enviroment with mysqli 
support and take the extension and use that on our servers.

I ran a simple
  ./configure --with-apxs2=/usr/bin/apxs2 --with-mysql=/usr/local/mysql 
  --with-mysqli=/usr/local/mysql/bin/mysql_config --with-zlib --with-gd

However I can't seem to find the extension. I ran php-config 
--extension-dir but it points to a directory that doesn't exist.

The only good thing to come out of this, is that I now have an 
environment where I can easily test builds.

George

---

## #22442 — Sara Golemon — 2006-03-15T02:34:40+00:00

URL: https://externals.io/message/22441#22442 · In reply to: #22441

> I ran a simple
>   ./configure --with-apxs2=/usr/bin/apxs2 --with-mysql=/usr/local/mysql
>   --with-mysqli=/usr/local/mysql/bin/mysql_config --with-zlib --with-gd
>
This'll build 'em staticly into a new mod_php5.so, but you want just the
extension so you can plug it into your existing webserver build.

First, forget about the chroot environment, you don't need it in order to
build a loadable extension.  Second, I'm assuming that when you installed
PHP originally, you did so from source and that you've still got that source
tree around somewhere.  Correct me on what ever points I got wrong...

cd /path/to/php_source/ext/mysqli
phpize
./configure --with-mysqli=shared,/usr/local/mysql/bin/mysql_config
make
cp modules/mysqli.so /path/to/extension_dir/


Edit php.ini:
Make sure your extension_dir setting exists and points to the same spot you
put your new module.
Add: extension=mysqli.so


Restart apache
Profit!

-Sara

---

## #22449 — George McLachlan — 2006-03-15T07:56:47+00:00

URL: https://externals.io/message/22441#22449 · In reply to: #22442

Sara Golemon wrote:
> > […]
> This'll build 'em staticly into a new mod_php5.so, but you want just the
> extension so you can plug it into your existing webserver build.
> 
> First, forget about the chroot environment, you don't need it in order to
> build a loadable extension.  Second, I'm assuming that when you installed
> PHP originally, you did so from source and that you've still got that source
> tree around somewhere.  Correct me on what ever points I got wrong...
> 
> cd /path/to/php_source/ext/mysqli
> phpize
> ./configure --with-mysqli=shared,/usr/local/mysql/bin/mysql_config
> make
> cp modules/mysqli.so /path/to/extension_dir/
> 
> 
> Edit php.ini:
> Make sure your extension_dir setting exists and points to the same spot you
> put your new module.
> Add: extension=mysqli.so
> 
> 
> Restart apache
> Profit!
> 
> -Sara
> 
  Thanks Sara,

  Oh dear,  don't think I should admit this, but in a blinding moment of 
stupidity I downloaded the source and cd'd to the directory where php 
was already intalled not the source. Hence I couldn't find the the 
mysqli dir in ext/ and made the wrong assumption that it would magically 
appear if I compiled it.To make matters worse I then cd'd to the source 
without noticing my mistake.

Ah well you learn by your mistakes. At least I got to build PHP from 
source (several times) and with chroot I can grab the latest snapshots 
from CVS and build them without it affecting the version I have 
installed. So it wasn't a complete waste of time

Thanks Again
George
