Yet another error 500 on fresh install

Hi Folks!

Maybe someone could help on that. I’ve seen dozens of posts with this same issue on this forum. Here is mine :slight_smile:

On a fresh FreePBX 2.1O install on openSUSE (so it’s NOT a FreePBX Distro) I’m getting an error 500 on first access to the web admin panel. My setup:

  • openSUSE 12.2*
  • FreePBX 2.10 (donloaded one week ago from this site)
  • Asterisk 10.11.2 (installed via openSUSE Factory repository)
  • MySQL 14.14 (openSUSE RPM)
  • PHP 5.3.15 (openSUSE RPM)
  • And assorted dependencies (libpri, DAHDI etc) all from openSUSE repositories.
  • Unfortunately, the FreePBX Distro is not an option in this case, as the ONLY Linux distro we’re allowed to use in this particular client is openSUSE.

I think I’ve followed everything by the book, from installing and running a working (and tested) Asterisk beforehand, creating the right users and databases on MySQL and running the correct SQL scripts to configuring httpd.conf and amportal.conf taking into account openSUSE differences (e.g. DocumentoRoot = /srv/www/htdocs).

The installation script executes with no errors. But, as I said, trying to browse the admin page gives me a blank page on Firefox and IE and an Error 500 on Chrome.

Absolutely no PHP errors are shown on /var/log/messages.

On /var/log/apache2/error_log, the error is:

[Tue Feb 19 21:29:30 2013] [error] [client 192.168.client.IP] PHP Warning: session_start(): open(/var/lib/php5 /sess_8n3lt4ch3db491svnlsqie1qauq063isr70vsseol8 o8ggeejv31, O_RDWR) failed: Permission denied (13) in /srv/www/htdocs/admin/config.php on line 69

On line 69 of aforementioned config.php there is only a session_start() function:

// This needs to be included BEFORE the session_start or we fail so // we can't do it in bootstrap and thus we have to depend on the // __FILE__ path here. require_once(dirname(__FILE__) . '/libraries/ampuser.class.php'); session_set_cookie_params(60 * 60 * 24 * 30);//(re)set session cookie to 30 da$ ini_set('session.gc_maxlifetime', 60 * 60 * 24 * 30);//(re)set session to 30 d$ if (!isset($_SESSION)) { //start a session if we need one session_start(); }

What did I do wrong?

Where on Suse are the session stored, normally /tmp, if so does a) php write them there successfully, and b) does your apache2 user have access to them?

Hummm…

Yes, it’s on /tmp and permissions there are 777.

Also, when trying to run amportal manually:

# amportal Fetching FreePBX settings with gen_amp_conf.php.. **** WARNING: ERROR IN CONFIGURATION **** astrundir in '/etc/asterisk' is set to but the directory does not exists. Attempting to create it with: 'mkdir -p ' . mkdir: missing operand Try 'mkdir --help' for more information. **** ERROR: COULD NOT CREATE **** Attempt to execute 'mkdir -p ' failed with an exit code of 1 You must create this directory and the try again.

But ASTRUNDIR is correctly configured.
And the directory really exists!

# cd /run/asterisk /run/asterisk # ll total 4,0K srwxr-xr-x 1 asterisk asterisk 0 Fev 19 22:06 asterisk.ctl= -rw-r--r-- 1 asterisk asterisk 4 Fev 19 22:06 asterisk.pid

And Asterisk is running OK:

# rasterisk Asterisk 10.12.1, Copyright (C) 1999 - 2012 Digium, Inc. and others. Created by Mark Spencer Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details. This is free software, with components licensed under the GNU General Public License version 2 and other licenses; you are welcome to redistribute it under certain conditions. Type 'core show license' for details. ========================================================================= Running as user 'asterisk' Running under group 'asterisk' Connected to Asterisk 10.12.1 currently running on myserver (pid = 519) myserver*CLI>

What next? I’m lost.

Oh, and my Apache2 user/group is asterisk/asterisk. An ls on /tmp shows that the Asterisk daemon itself is able to write there, so Apache should have no problem with that, I presume.

You might want to get FreePBX by svn as I believe there are a few fixups there that cover a proper install when documentroot is not /var/www/html (redhat style)

Hmmmm… thanks, will try that.

I’ll keep you posted.

Ok, I’m back.

The SVN version DID NOT WORK in my setup.

So I reinstalled everything (including openSUSE) and moved /srv/www to /var/www and reconfigured Apache to point to the new DocumentRoot.

Woa! It worked! At least, I didn’t get an Error 500.

BUT… the FreePBX admin interface is up and running, but I can’t seem to do anything with it. After I login to the admin page, I’m presented with this gorgeous error:

Symlink from modules failed. retrieve_conf failed to sym link: /etc/asterisk/iax.conf from core/etc (Already exists, not a link) /etc/asterisk/sip.conf from core/etc (Already exists, not a link) /etc/asterisk/features.conf from core/etc (Already exists, not a link) /etc/asterisk/sip_notify.conf from core/etc (Already exists, not a link) /etc/asterisk/logger.conf from core/etc (Already exists, not a link) /etc/asterisk/extensions.conf from core/etc (Already exists, not a link) This can result in FATAL failures to your PBX. If the target file exists and not identical, the symlink will not occur and you should rename the target file to allow the automatic sym link to occur and remove this error, unless this is an intentional customization. Added 6 minutos ago (retrieve_conf.SYMLINK)

I guessed that pressing the Big Red Button “Apply Config” would solve that, but I’m presented with a modal dialog box saying:

Error! Error: Invalid response from server XHR response code: 200 XHR responseText: undefined jQuery status: parsererror

Oh, Myyyyyy…
What did I do wrong now??

Found something else.

I guess the install script is failing to create the symlinks by itself. An LS in /etc/asterisk shows that the script creates (for instance) an empty sip_additional.conf, but it doesn’t copy the original sip.conf somewhere else, doesn’t remove the original sip.conf and that’s why it can’t create the symlink ponting elsewhere to FreePBX’s sip.conf.

It happens to all the other conf files that are handled by FreePBX.

I have already tried deleting /etc/asterisk and restoring a previous backup, with a functional Asterisk and without FreePBX. Reinstalled FreePBX and no-go.

Everything in /etc/asterisk is owned by asterisk.asterisk.

I’ve found the issue, documenting here to help other adventurous openSUSE lovers.

on /var/lib, there are some directories that are the “homedirs” for some users and processes. When I configured Apache to run as the asterisk user, I correctly chowned /var/lib/apache2 to asterisk.asterisk, but nothing else.

The thing is, PHP sessions are saved in /var/lib/php5, so I had to chown that too.

I discovered that because every time I clicked on a link FreePBX annoyingly asked me for my user/pass again. So the session information was not being saved anywhere - and at that moment I remembered /var/lib.

Well, thanks folks for all your help.
Hope my sweat helps others.

What svn version did you use? You state here that it didn’t work but you never gave a version from SVN so I doubt you are even using the right one!

Oh, and a special thank you to dicko. He pointed me out the possibility of PHP sessions not being saved.

Thanks, man!

I was too lazy to learn how to use/setup/check out an SVN repo here (last time I worked with version control it was CVS, 12 years ago…) so I just browsed to http://svn.freepbx.org/freepbx/trunk/ and dl everything with wget.

There was a number on the top of the page, but I can’t remember that.

Did I do something wrong?

trunk is not the right area. The right area is: http://svn.freepbx.org/freepbx/branches/2.11/

Our bad for not telling you this. All of the corrections for non-cent systems have been applied to 2.11