Loading extensions in PHP5 php.ini

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Loading extensions in PHP5 php.ini

Post by RobertGonzalez »

Ok, so I have searched a bit, and I cannot seem to find the answer I need. Here goes...

We just installed FC5 as a precursor to our eventual RHEL4 install. The core PHP configuration that comes with FC5 has a load of extensions loaded with the distro, but some that I need are not there. So I want to load these extensions. On Windows this is a snap... uncomment the lines in the ini file and make sure they are in the extensions folder. However, on Linux this seems not to be the case. My question:

How do I enable extensions in PHP5 on Linux? There are literally two .so files in the extensions directory at the moment, neither of which are the ones I want to install. What do I do?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

The extensions may ship as extra packages, e.g php_mysql or similar.
Take a look at http://fedora.redhat.com/docs/yum/en/sn ... kages.html and then search for available php modules.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I followed those directions and did a 'yum search php_mysqli' and it returned no results. Broadened it to 'yum search *mysqli*' and still got nothing.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Okay, I might be getting somewhere. Maybe. How do you build PHP? I keep seeing these lines:

Code: Select all

./configure --some_mod -some-flag
make
make install
I have also seen the instruction

Code: Select all

Do a ./configure --help to see what options you can use
But regardless of where I try to execute that call, it errors out.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

I have no clue of fedora, yum etc. But google knows (almost) everything :)
http://www.google.de/search?hl=en&q=fed ... tnG=Search :arrow: http://fedora.redhat.com/docs/release-notes/fc4/errata/
7.5.2. php

Version 5.0 of PHP is now included, which includes a number of changes to the language along with significant performance improvements. Please refer to the PHP documentation for more information on migrating from PHP 4.3 to PHP 5.0:

http://www.php.net/manual/en/migration5.php

The /usr/bin/php binary is now built using the CLI command-line SAPI, rather than the CGI SAPI. Use /usr/bin/php-cgi for CGI SAPI. The php-cgi also includes FastCGI support.

The following extensions have been added:

*

The mysqli extension, a new interface designed specifically for MySQL 4.1. This is included in the php-mysql package.
I would give it a shot on fc5, too.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Code: Select all

# php -r 'print_r(get_loaded_extensions());'
Array
(
    [0] => libxml
    [1] => xml
    [2] => wddx
    [3] => tokenizer
    [4] => sysvshm
    [5] => sysvsem
    [6] => sysvmsg
    [7] => standard
    [8] => SimpleXML
    [9] => sockets
    [10] => SPL
    [11] => shmop
    [12] => session
    [13] => Reflection
    [14] => pspell
    [15] => posix
    [16] => pcntl
    [17] => mime_magic
    [18] => iconv
    [19] => hash
    [20] => gmp
    [21] => gettext
    [22] => ftp
    [23] => exif
    [24] => date
    [25] => curl
    [26] => ctype
    [27] => calendar
    [28] => bz2
    [29] => zlib
    [30] => pcre
    [31] => openssl
    [32] => ldap
)
I need mysqli and Sybase. I am looking into rebuilding PHP with those extensions, but the manual sucks at describing that.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Did you try the php-mysql package?
I am looking into rebuilding PHP with those extensions, but the manual sucks at describing that.
fedora doesn't look like a classic "yeah great, compile it yourself" distro like e.g. gentoo.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I did a find and whereis php_mysql and php-mysql and it is not on our system.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

You need to install it via yum.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I did a yum search for php-mysqli and for *mysqli* and there were no matches found. Can I rebuild PHP to include those extensions? I am not at all sure how to do that.

Also, I ran a php -i from the prompt and found these in my output...

Code: Select all

'--with-mysql=shared,/usr' 
'--with-mysqli=shared,/usr/bin/mysql_config' 
'--with-pgsql=shared' 
'--enable-pdo=shared' 
'--with-pdo-odbc=shared,unixODBC,/usr' 
'--with-pdo-mysql=shared,/usr' 
'--with-pdo-pgsql=shared,/usr' 
'--with-pdo-sqlite=shared,/usr'
I thought when these flags were added that the extensions were loaded. Is that not the case? I am going strictly on not seeing the extensions in php.ini or any .so files in the extensions directory.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Everah wrote:I did a yum search for php-mysqli and for *mysqli* and there were no matches found.
summary of http://fedora.redhat.com/docs/release-notes/fc4/errata/ 7.5.2 php: "php-mysqli is included in the package php-mysql"
Have to tried to install the package php-mysql (without trailing i)?

I strongly adivse against compiling software on a "binary" system you're not familar with. You probably can, no sweat. But you should first get acquainted with fedora's package managment.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Man, I feel like such a newbie. Thanks volka. I really appreciate the time. I working on getting that installed as we speak.

Alright. Now I feel really smarter alot prolly. Thanks again volka.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Self compilation > Automanaged :P


Also as a general heads up, if you ever start wondering where your docroot is, it's going to be /var/www and not in the httpdocs folder like it is on windows as default when automanaged.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Yeah, I got that much from my last 'experience' with Linux. This is actually pretty fun. It reminds me of when I was first learning PHP. It feels good to be young again.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

If you like this sort of stuff, you'll love Gentoo (if you don't pull your hair out :P)

That flashy KDE/Gnome that comes with Fedora? You have to install yourself.

Those kwirky appliances such as "Graphics Card" and "Sound Card" and even one of those new fangled pieces of technology called "Modem".. you have to install the drivers all by yourself too :p

The beauty of Gentoo lies in that you actually create your own Kernel which can encompass all the above,if you wish, so it is Blisteringly fast. 8)
Post Reply