PHP Fatal error: Cannot redeclare acquia_session_store_config()

318 views
Skip to first unread message

Charlie

unread,
May 12, 2017, 11:14:22 AM5/12/17
to SimpleSAMLphp
What are you trying to do?

At the moment, I'm trying to access the simplsaml page by going to: subsite.mysite.com/simpelsaml

What have you done?

Describe here the steps you have taken:
  • Checked the whole project for multiple calls of the function acquia_session_store_config and there isn't although I am using symlink to the simplesamlphp/config folder
  • I have tried wrapping the function into an IF !function_exists statement
  • I put in an error_log inside the function to see if it actually gets run more than once and that error_log didn't even show in the log
  • I've commented out the line $config = acquia_session_store_config($config, $ah_options);
This is the part that it was complaining about.

if (empty($_ENV['AH_SITE_ENVIRONMENT'])) {
// add any local configuration here
} else {
$ah_options['env'] = $_ENV['AH_SITE_ENVIRONMENT'];
$config = acquia_logging_config($config);
$config = acquia_session_store_config($config, $ah_options);
}

function acquia_session_store_config($config, $ah_options) {
if ($ah_options['session_store'][$ah_options['env']] == 'memcache') {
$config = mc_session_store($config);
} elseif ($ah_options['session_store'][$ah_options['env']] == 'database') {
$config = sql_session_store($config, $ah_options['database_name']);
}
return $config;
}

And this is the documentation that I was trying to follow:


Is there anything wrong?

When accessing the /simplesaml page, it shows a 500 error. I looked in the log and this is what it shows:

php-error ded-18375 [12-May-2017 12:43:30 UTC] PHP Fatal error: Cannot redeclare acquia_session_store_config() (previously declared in /mnt/www/html/mysite/simplesamlphp/config/config.php:925) in /mnt/www/html/mysite/simplesamlphp/config/config.php on line 925 request_id="v-9a2d5800-3710-11e7-a4a0-22000ada0853"


Is there anything you don't understand?

It works in our dev environment without a problem so I'm not sure why it failed in the production server.

Jaime Perez Crespo

unread,
May 18, 2017, 5:28:34 AM5/18/17
to simple...@googlegroups.com
Hi Charlie,
Strictly speaking, it doesn’t look like. Though I would advise not to declare functions or classes in the configuration file. It’s probably a good idea to move that to a separate function and use “require_once” to load that file.

> When accessing the /simplesaml page, it shows a 500 error. I looked in the log and this is what it shows:
>
> php-error ded-18375 [12-May-2017 12:43:30 UTC] PHP Fatal error: Cannot redeclare acquia_session_store_config() (previously declared in /mnt/www/html/mysite/simplesamlphp/config/config.php:925) in /mnt/www/html/mysite/simplesamlphp/config/config.php on line 925 request_id="v-9a2d5800-3710-11e7-a4a0-22000ada0853"
>
> Is there anything you don't understand?
>
> It works in our dev environment without a problem so I'm not sure why it failed in the production server.

That could also indicate some kind of misconfiguration. In general, configurations are cached, so the config.php file shouldn’t be passed through the PHP interpreter more than once for each execution.

--
Jaime Pérez
UNINETT / Feide

jaime...@uninett.no
jaime...@protonmail.com
9A08 EA20 E062 70B4 616B 43E3 562A FE3A 6293 62C2

"Two roads diverged in a wood, and I, I took the one less traveled by, and that has made all the difference."
- Robert Frost

Chong Lor

unread,
May 18, 2017, 2:58:24 PM5/18/17
to SimpleSAMLphp
Okay, our dev environment has one server and in our prod, we have two servers for load-balance. So, based on this documentation, https://simplesamlphp.org/docs/1.9/simplesamlphp-maintenance, I'm configured my memcache_store.servers as followed:

'memcache_store.servers' => array(
array(
//array('hostname' => 'localhost'),
array('hostname' => 'dad-18384'),
array('hostname' => 'dad-18385'),
),
),

However, I am still receiving 503 Service Termporarily Unavailable error after it's authenticated and returning back to mysite.com/simplesamlphp page.


--
This is a mailing list for users of SimpleSAMLphp, not a support service. If you are willing to buy commercial support, please take a look here:

https://simplesamlphp.org/support

Before sending your question, make sure it is related to SimpleSAMLphp, and not your web server's configuration or any other third-party software. This mailing list cannot help with software that uses SimpleSAMLphp, only regarding SimpleSAMLphp itself.

Make sure to read the documentation:

https://simplesamlphp.org/docs/stable/

If you have an issue with SimpleSAMLphp that you cannot resolve and reading the documentation doesn't help, you are more than welcome to ask here for help. Subscribe to the list and send an email with your question. However, you will be expected to comply with some minimum, common sense standards in your questions. Please read this carefully:

http://catb.org/~esr/faqs/smart-questions.html
---
You received this message because you are subscribed to a topic in the Google Groups "SimpleSAMLphp" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/simplesamlphp/0Lhb4dYiJaQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to simplesamlphp+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chong Lor

unread,
May 18, 2017, 3:02:33 PM5/18/17
to SimpleSAMLphp

Chong Lor

unread,
May 18, 2017, 3:42:32 PM5/18/17
to SimpleSAMLphp
This is the URL that it errors on when returning back from the authentication.

Chong Lor

unread,
May 18, 2017, 3:44:45 PM5/18/17
to SimpleSAMLphp
I have a hunch that the issue may be coming from the foreach loop of this function.

function mc_info() {
$creds_json = file_get_contents('/var/www/site-php/' . $_ENV['AH_SITE_NAME'] . '/creds.json');
$creds = json_decode($creds_json, TRUE);
$mc_server = array();
$mc_pool = array();
foreach ($creds['memcached_servers'] as $fqdn) {
$mc_server['hostname'] = preg_replace('/:.*?$/', '', $fqdn);
array_push($mc_pool, $mc_server);
}
return array($mc_pool);
}

Chong Lor

unread,
May 19, 2017, 10:14:51 AM5/19/17
to SimpleSAMLphp
This is the error log from shibboleth when I tried to test the authentication from subsite.mysite.com/simplesaml and it failed right after it's authenticated. My guess at this point is that either there is something specifically different in our prod server settings/configurations or in my config.php file that is missed configured/missing. The redundant configuration with load balancing is showing with the correct hostname.

2017-05-16 21:15:07,750 - WARN [org.opensaml.saml.common.binding.security.impl.MessageReplaySecurityHandler:155] - Message Handler:  Replay detected of message '_109fad6ff5cfe8ad725b0de7f0e6ca1c6fa148ed41' from issuer 'https://subsite.mysite.com/simplesaml/module.php/saml/sp/metadata.php/default-sp'
2017-05-16 21:15:07,750 - WARN [net.shibboleth.idp.profile.impl.WebFlowMessageHandlerAdaptor:182] - Profile Action WebFlowMessageHandlerAdaptor: Exception handling message
org.opensaml.messaging.handler.MessageHandlerException: Rejecting replayed message ID '_109fad6ff5cfe8ad725b0de7f0e6ca1c6fa148ed41' from issuer https://subsite.mysite.com/simplesaml/module.php/saml/sp/metadata.php/default-sp
                at org.opensaml.saml.common.binding.security.impl.MessageReplaySecurityHandler.doInvoke(MessageReplaySecurityHandler.java:156)

Chong Lor

unread,
May 19, 2017, 10:42:54 AM5/19/17
to SimpleSAMLphp
Okay, so here's another thing I've found. If I succesffully authenticated in our Dev environment then if I came back to subsite.mysite.com/simplesaml and test the authentication then it works fine. I am able to get all the attribute values. So, is this a sign of my:

1. cert files incorrectly implemented on prod
2. metadata files such as saml20-idp-remote.php and/or saml20-sp-remote.php configuations for prod
3. memcache on prod not working/configured correctly
4. prod server/environment configuration issues
5. something else

Chong Lor

unread,
May 19, 2017, 6:21:53 PM5/19/17
to SimpleSAMLphp
Here's another thing I found. Right after I've successfully tested SSO authentication on dev.subsite.mysite.com/simplesaml, testing subsite.mysite.com/simplesaml on Prod will still result in an error; however, if I wait about 5-15 minutes later, the SSO authentication test on Prod will work by showing all the attribute names and values. I don't believe this is a local cache or cookie because once SSO authentication testing works on a Windows machine, I can go to a Mac machine launch Safari in private or Chrome incognito and testing SSO authentication would work. The difference is, instead of asking for user name and password, it'll just show all my attribute names and values right away. So, does this mean something in my config.php file is caching the credentials on the server?

Chong Lor

unread,
May 24, 2017, 10:16:54 AM5/24/17
to SimpleSAMLphp
Would it be possible that since the Prod environment has load-balance of two servers, simplesamlphp tries send the authentication the second time; thus shibboleth refused? If so, how do I configured simplesamlphp to stop sending after it has been successfully authenticated the first time?

On Sat, May 20, 2017 at 7:20 AM, Chong Lor <ljt...@gmail.com> wrote:
Okay, as I've troubleshooting this issue, I've found that after simplesamlphp failed to successfully retrieve the attribute values, if I waited for like 5-10 minutes and try again, it works. It looks like some kind of session is cached on the server. The issue now is, why is it failed on the first try? Base on shibboleth log, why is simplesamlphp send the second request after the first?

sha...@gmail.com

unread,
Jun 14, 2017, 10:41:26 AM6/14/17
to SimpleSAMLphp
We are getting the same error on some of our Acquia environments.  We use 4 development environments and 1 prod (prod is load balanced).  2 of the 4 dev environments and prod works fine.  2 other dev environments fail with the same error.  I suspect this is actually an Acquia infrastructure problem, but I'm not having luck pinning it down yet.

Chong Lor

unread,
Jun 14, 2017, 1:02:17 PM6/14/17
to SimpleSAMLphp
Thanks for sharing your experience. We are contact with Acquia but so far they have not gotten a resolution yet. I've switched to database from memcache and it's still the same issue. I've gotten to the point where it'll work for the first login but if you logout and try again, it'll fail. Or if you open an incognito open and try to login, it'll fail as well.

--

jeramy...@gmail.com

unread,
Feb 28, 2018, 3:28:59 PM2/28/18
to SimpleSAMLphp
I realize that this was a year ago, but I have just started to receive the same error message, 'PHP Fatal error: Cannot redeclare acquia_session_store_config() (previously declared in /mnt/www/html/mysite/simplesamlphp/config/config.php...', after the most recent simplesamlphp update (RC6). Did you ever get a resolution?

Thank you.

Jeramy
To unsubscribe from this group and all its topics, send an email to simplesamlph...@googlegroups.com.

Amir Meshkin

unread,
Aug 4, 2022, 1:37:54 PM8/4/22
to SimpleSAMLphp
We just upgraded to php 8.1 and we have the same issue. That function isn't even in our codebase.

Peter Brand

unread,
Aug 5, 2022, 9:12:51 AM8/5/22
to simple...@googlegroups.com
* Amir Meshkin <amir.m...@gmail.com> [2022-08-04 19:38]:
> We just upgraded to php 8.1 and we have the same issue. That function isn't
> even in our codebase.

Needless to say, anything acquia_ certainly doesn't come from SimpleSAMLphp, either.

-peter
Reply all
Reply to author
Forward
0 new messages