# fatal error, phppgadmin

## bignate

I have been trying without success to install phppgadmin today. 

When I navigate to http://localhost/phppgadmin/

I get:

Fatal error: Call to undefined function session_name() in /var/www/localhost/htdocs/phppgadmin/libraries/lib.inc.php on line 76

I installed it with Portage/webapp-config (w/o vhosts in my USE flags), I tried both unmasked and masked versions.  I am using a masked version of mod_php (I need it for work).

dev-php/mod_php-5.0.4

dev-db/phppgadmin-3.5.3

dev-db/postgresql-8.0.1-r

I have looked trough the config file and googled, but can't seem to put my finger on the problem. I was hoping someone might have an idea.

TIA

----------

## tukachinchila

The 'session_name()' function is a part of PHP4 and PHP5, so the problem is with your installation of PHP5. As a workaround (since you don't really need to define the session name), try commenting out (using //, not #) line 76 of /var/www/localhost/htdocs/phppgadmin/libraries/lib.inc.php, and line 10 of /var/www/localhost/htdocs/phppgadmin/logout.php.

The function 'session_start()' which is on line 77 and line 11 in the above files respectively will set the session name to the PHP default instead of setting it to 'PPA_ID'. It should work in theory anyway, but you may get a similar error with the session_start() function. If that's the case, then phppgadmin will probably not work with PHP5 currently.

----------

## bignate

Ok, interesting.  Thanks.  I tried that and it did in fact error out with the session_start() func.  However, my coworker is successfully running it on gentoo with PHP5 (though it's php-5.0.3, which may or may not matter).  Hmm, well back to digging.  Thanks for the heads up, I may be able to get somewhere here.

----------

## bignate

I am not sure how, but after changing a million things and recompiling mod_php, postgres and phppgadmin a few dozen times it somehow came up.  I wish I could narrow it down better since it might happen to someone else, but I really can not remember all the different things I have done, nor which one of them ultimately worked.  Thanks for the help tukachinchila.

----------

## Filo_kg

The solution is very simple - you must emerge mod_php with "+session" USE flag. Please chande the topic to [SOLVED].

----------

## bignate

uh...if it were that simple I would have posted that as a fix.  I didn't mark it [SOLVED] because I don't recall how I did it, as my earlier post states.  The first thing I tried was adding session to my USE flags, and it didn't work.  Please try not to presume what others have done.

----------

## Filo_kg

 *bignate wrote:*   

> Please try not to presume what others have done.

 

I can only say that I had the same problem as you and I've solved it by adding this flag. What is more it is logical that without persistent sessions handling compiled in php has problems with finding session_name and session_start functions. I'm just trying to help. Marking the topic is completely up to you.

----------

## Shienarier

Perhaps the application in question simply doesn't support PHP5 yet.

----------

## opensas

I'm also trying to use phppgadmin with php 5.0.5-r4

I've followed the guide at http://gentoo-wiki.com/Apache_Modules_mod_php to install apache and php 5 (I don't have mod_php emerged, I emerged dev-lang/php)

I stumbled with the same session problems, until I added 

=dev-lang/php-5.0.5-r4 -berkdb -gdbm session

to /etc/portage/package.use

Now I'm getting the following warning:

```

/var/www/localhost/htdocs/phppgadmin/conf/config.inc.php

 Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/www/localhost/htdocs/phppgadmin/conf/config.inc.php:1) in /var/www/localhost/htdocs/phppgadmin/libraries/lib.inc.php on line 77

 

 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/localhost/htdocs/phppgadmin/conf/config.inc.php:1) in /var/www/localhost/htdocs/phppgadmin/libraries/lib.inc.php on line 77

```

Any idea???

Saludos

Sas

PS: I also had to edit /var/lib/postgresql/data/pg_hba.conf 

```

#local   all         all                               trust

#edited for phppgadmin

local   all         all                               md5

```

But I don't think it has anything to do with my problem...

----------

## opensas

Well, I tried with phpPgAdmin 4.0 (PHP 5.0.5-pl3-gentoo), and it works fine (but it's not even in thr portage tree yet)

I had to edit /var/lib/postgresql/data/pg_hba.conf and set the local access back to trust mode.

Saludos

Sas

PS: I've learnt in these forums that upgading to the latest version IS NOT a solution. So I hope someone can solve this thing...

----------

## doodb

scuse me for my bad english (i'm french)

USE="session apache2 cgi cli -threads dba gd" emerge --ask  dev-lang/php

if you use apache 1.x replace apache2 by apache

i used this and it works whith postgresql and phppgadmin (php5)

good luck

see you...

dood

----------

