Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] PHP with MySQL support, only library no client
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
costa
n00b
n00b


Joined: 10 Dec 2012
Posts: 2

PostPosted: Mon Dec 10, 2012 6:46 pm    Post subject: [SOLVED] PHP with MySQL support, only library no client Reply with quote

Hi there,
I am building a server with LXC and I have a container already set up as a database server and other containers with different web services. I would like to have PHP with MySQL support which is pretty much an extra set of libraries, but when I add the USE flag (mysql) to the package, portage builds the entire MySQL as a dependency, which I don't need. I know I can build MySQL with the USE flag "minimal" which doesn't install the server but still, I don't need the client! Only the libraries.
Other distributions have a separate package such as php-mysql for this.
Is it possible to fix this or do I have to write my personal ebuild?


Last edited by costa on Tue Dec 11, 2012 8:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
Mad Merlin
Veteran
Veteran


Joined: 09 May 2005
Posts: 1155

PostPosted: Tue Dec 11, 2012 12:24 am    Post subject: Reply with quote

Just to clarify, you would need both libmysqlclient.so* (from the mysql package) and php-mysql (the php module which links against said library). I guess if you really wanted to rip out the mysql cli client, you'd need to hack up your own ebuild, but you wouldn't be saving yourself much space (and you might end up kicking yourself down the road if you ever need to debug database issues from the client side).
_________________
Game! - Where the stick is mightier than the sword!
Back to top
View user's profile Send private message
miket
Guru
Guru


Joined: 28 Apr 2007
Posts: 483
Location: Gainesville, FL, USA

PostPosted: Tue Dec 11, 2012 2:20 pm    Post subject: Reply with quote

Starting with the 5.3 series, PHP made a change with regard to MySQL support. Previously, if you wanted to use one of PHP's MySQL API's, PHP always had to link against the upstream MySQL C library. For v. 5.3, they added their own MySQL client library hand-tuned to support the PHP engine better than the client library from the MySQL upstream. They call this the MySQL Native Driver for PHP (mysqlnd).

When I read about it--and started specifying it when I build PHP--the main advantage for the the library is better performance. Also of particular interest to the Debian project, mysqlnd falls under PHP license and avoids any of their sqeamishness in mixing the PHP license with the GPL. For your purpose, the third advantage looms large: no dependency on MySQL.

So emerge PHP with the mysqlnd USE flag along with whatever you need of mysql, mysqli, or pdo and then enjoy not seeing MySQL getting pulled in.

Even though I generally do build MySQL on machines when I build PHP, I've taken to using mysqlnd everywhere.
Back to top
View user's profile Send private message
costa
n00b
n00b


Joined: 10 Dec 2012
Posts: 2

PostPosted: Tue Dec 11, 2012 8:55 pm    Post subject: Reply with quote

Thank you very much for the explanation, miket, that was exactly what I was looking for!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum