I've forgotten how I compiled PHP & now I need to add Po

Hi,

Months ago I spent about 175 hours setting up my server with Nxinx, Mysql, PHP, sudsomething APC and got it all working with phpmyadmin etc, plus threw in a helping of Teamspeak 3 server just to really set my teeth on edge.

Well it's all worked great, but now I need Postgresql for a project, and I am going to have to compile PHP again.

The trouble is, I don't want to lose whatever way I have PHP set up currently, I just want to keep it all and add in postgre. Is there any way to do this please? I didn't write down all the added arguments I gave the last php compile, I didn't realise I would need them again. Is there any way to tell it just to add postgre and keep the rest the same? Or so I have to start from scratch and install nginx, php, etc?

Thanks for you help,

TT

P.S. I seem to have forgotten all that I learned from when I made the server build the first time.

12 Replies

Ah yes, here is the way I installed it all (by the way):

https://github.com/vladgh/VladGh.com-LEMP

Why did you compile php?

Anyway, you'll want to install postgresql and the development libraries, download the php source for your php version, then pop into the pgsql extension directory (off hand probably something like ext/pgsql) and run the phpize command, then ./configure && make && make test && make install

Thanks for your answer!

After the phpize, did you mean type this as one line? ("./configure && make && make test && make install" and what directory should I be in, the PHP one or Postgre?

Sorry if this sounds stupid, would you believe that at one time I wrote computer games, a Z80 emulator, simple disk OS etc, but all the intricacies of this make my head spin - my trouble is remembering them all for all the different packages ;) I've spent the last 10 years on windows and know it inside out, but this is completely different. Reminds me a bit of working on a Commodore Pet years ago ;)

Yes the command is on one line and should be in the same directory you ran phpize in

(Also if you can you should consider switching to your distros php version instead of compiling your own)

The problem is though, I can install postresql, but in order to get it to work with php I am reading that I need to recompile php.

Is that not correct?

Using your method above, will I lose any of my earlier compile options on PHP? The reason it was originally compiled was to add stuff like suhosin(?) APC and some other bits.

I would hate for them to fall off ;)

If you compiled php then no you don't need to recompile it, you can compile a dynamic extension and install that which is what I gave you commands to do.

If you installed php, then it's an apt-get/yum/whatever your distro's installer is away.

The commands I gave only compile a dynamic extension that's it so nothing will be lost.

I did compile it, so excellent :) Thanks very much for your help.

By the way, I used this guide: http://vladgh.com/blog/install-nginx-an … on=node/18">http://vladgh.com/blog/install-nginx-and-php-php-fpm-mysql-and-apc?destination=node/18

(you might need to create a dummy login to read, just put a junk email address and you will see it without having to go through the whole registration process - it's quick, honest)

The reason I used that at the time was because I wanted a working nginx installation with those other options and the feedback on his method was very good, some of it from some well known & respected commentators. So I thought I would go with his method as it got me what I wanted in my LEMP stack. It's actually worked really well and I am happy with it.

The trouble came when I then needed to add something and because I didn;t understand properly the process I followed, I was stuck. I didn't realise that making something didn't mean a full recompile. In the old days (when I used make to compile assembly language into machine code) it meant you were doing the whole thing again.

So, I now understand (from your help explanation) that it seems to only recompile the bit you are working on - which is definitely more intuitive.

I just thought I would add that so you knew where I was coming from as it was maybe a bit confusing ;)

Thanks again for your help - it is much appreciated and has saved me valuable time :)

EDIT: Oh and also, another reason for compiling and not using my distro builds is that I need some of the newer features. For example, the postgresql version with distro is 8.4. Version 9.0 introduces a feature that is absolutely key to what I am doing - replication with slave read servers allowing a hot swap.

Ack! I have hit a problem :(

I am using a installed (.bin executable) version of postgresql that has added monitoring tools from enterprisedb.com

After installing, my phpinfo shows no postgre modules. Now obviously this is a question for their support, but could anyone here comment on the generalities of what I am doing. i.e. is it generally not possible to install from bin if I am hoping to then integrate with PHP, or is it just a matter of having the source and phpizing it?

You probably need to edit your php.ini file with extension=.so

I recompiled it ok, but a lot of errors to do with the postgresql version supplied by enterprisedb.com, otherwise ok.

I'm waiting to hear from them before just going with 9.0 from repository I think.

I will update this in due course.

Example:

/root/lemp/php-5.3.5/sapi/cli/php: /opt/PostgresPlus/9.0SS/lib/libxml2.so.2: no version information available (required by /root/lemp/php-5.3.5/sapi/cli/php)  
/root/lemp/php-5.3.5/sapi/cli/php: /opt/PostgresPlus/9.0SS/lib/libxml2.so.2: no version information available (required by /root/lemp/php-5.3.5/sapi/cli/php)  
/root/lemp/php-5.3.5/sapi/cli/php: /opt/PostgresPlus/9.0SS/lib/libxml2.so.2: no version information available (required by /root/lemp/php-5.3.5/sapi/cli/php)  
/root/lemp/php-5.3.5/sapi/cli/php: /opt/PostgresPlus/9.0SS/lib/libxml2.so.2: no version information available (required by /root/lemp/php-5.3.5/sapi/cli/php)  
/root/lemp/php-5.3.5/sapi/cli/php: /opt/PostgresPlus/9.0SS/lib/libxml2.so.2: no version information available (required by /root/lemp/php-5.3.5/sapi/cli/php)  
/root/lemp/php-5.3.5/sapi/cli/php: /opt/PostgresPlus/9.0SS/lib/libxml2.so.2: no version information available (required by /root/lemp/php-5.3.5/sapi/cli/php)  
/root/lemp/php-5.3.5/sapi/cli/php: /opt/PostgresPlus/9.0SS/lib/libxml2.so.2: no version information available (required by /root/lemp/php-5.3.5/sapi/cli/php)  
/root/lemp/php-5.3.5/sapi/cli/php: /opt/PostgresPlus/9.0SS/lib/libxml2.so.2: no version information available (required by /usr/lib/libexslt.so.0)  
/root/lemp/php-5.3.5/sapi/cli/php: /opt/PostgresPlus/9.0SS/lib/libxml2.so.2: no version information available (required by /usr/lib/libexslt.so.0)  
/root/lemp/php-5.3.5/sapi/cli/php: /opt/PostgresPlus/9.0SS/lib/libxml2.so.2: no version information available (required by /usr/lib/libexslt.so.0)  
/root/lemp/php-5.3.5/sapi/cli/php: /opt/PostgresPlus/9.0SS/lib/libxslt.so.1: no version information available (required by /usr/lib/libexslt.so.0)  

libxml2 is installed and the latest version by the way.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct