1

I am trying to get a survey (PHP files) to work on an Apache server. I tried it first with XAMPP, but then got the following error message:

Fatal error: Call to undefined function pg_escape_string() in /opt/lampp/htdocs/imageability/SkjemaDatabase.php on line 551

I tried a variety of solutions to this to get PostgreSQL to work together with XAMPP, but nothing seemed to work. So I have now decided to try installing PHP5, Apache2, PostgreSQL (and MYSQL) seperately. I followed these instructions for the installations and thought I would have got PostgreSQL installed and working this time for sure. But instead of working, or rendering the same error message again, this just gives me a blank page when trying to check out the survey in Firefox. Am running Lubuntu 14.02 by the way.

I have some other PHP files on the server that work fine. Could it still be something about PostgreSQL that's not working? While trying out XAMPP I tried uncommenting the following lines in my php.ini file

extension=php_pdo_pgsql.dll
extension=php_pgsql.dll

But now (with the various software installed seperately) I actually can't find the lines at all in /etc/php5/apache2/php.ini or /etc/php5/cli/php.ini, but I'm not sure which file to look in.

I also read advise (during XAMPP problem with PostgreSQL) to copy the file libpq.dll from c:/xampp/php/ to /xampp/apache/bin/, but I didn't seem to have this file and still don't.

Below are some other ideas about what might be wrong, but maybe the above are more plausible?

Another problem I had during the process was that while following the last instructions at the link above, I made the mistake of creating a super user with password and switching to postgres user. After this I couldn't open Pgadmin3, so I switched back to the usual user and then that at least worked. Could my error now have something to do with still having this superuser? Or is there something I have to do in Pgadmin3 to get my survey to work on the server? (I.e. I haven't done anything in Pgadmin3 now, just installed the above mentioned software and put my files in /var/www/htlm/.)

Very grateful for any help!

2 Answers 2

3

Okay, I now found out the main problem was I didn't get any error messages.

To solve this, open the file /etc/php5/apache2/php.ini in a text editor as root. (In the terminal window, type the command sudo emacs /etc/php5/apache2/php.ini and press enter). Locate the line

display_errors = Off

and change it to

display_errors = On`

This helped me see that there was nothing wrong with PostgreSQL when using it with Apache2 installed separately (as opposed to when using XAMPP). See this answer too, for more details on how to set up a developer environment on Debian/Ubuntu, to avoid having to use XAMPP if you wish to avoid it.

0

have you tried installing php5 on your ubuntu ?

sudo apt-get install php5

then reconfigure the apache2 config file.

is your php service is running ?

1
  • I've installed php5, yes. PHP seems to be working too, yep. Reconfiguring the apache config file I'm not sure how to do though.
    – Ingrid
    Jul 3, 2015 at 19:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .