Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Cannot redeclare services_twilio_autoload() #97

Closed
ghost opened this issue Oct 15, 2012 · 3 comments
Closed

Fatal error: Cannot redeclare services_twilio_autoload() #97

ghost opened this issue Oct 15, 2012 · 3 comments

Comments

@ghost
Copy link

ghost commented Oct 15, 2012

I consistently get this error on my local machine (OSX running MAMP with PHP 5.3.6) but do not have this problem on a different server running PHP 5.3.3. When I switch my local machine to use PHP 5.2.17 the issue also goes away. I suspect the issue isn't the PHP version, but rather something in the server configuration. However, the reported error message does not give me enough information to debug the problem. The fatal error in question is:

Fatal error: Cannot redeclare services_twilio_autoload() in /local/path/to/twilio.php on line 3

Line 3 is the first place Services_Twilio_autoload is defined, so I cannot figure out why it might be trying to redeclare itself.

@ghost
Copy link
Author

ghost commented Oct 15, 2012

I was able to find where in my code I was triggering the problem. The project in question is using the CakePHP framework. At the spot where the Twilio code is included there were effectively two includes, the second of which triggered the error. The first used CakePHP's App::import() function, which apparently uses a "require" under the hood. The second was a require_once with a comment about how on the live server the previous statement was insufficient.

@ghost ghost closed this as completed Oct 15, 2012
@kevinburke
Copy link
Contributor

That doesn't seem good. I admit I'm not that familiar with CakePHP, but glad you sorted out the issue.

Best,
Kevin

@InfiniteDevelopment
Copy link

I am having the same issue doing the phone poll example. Any ideas why?

Fatal error: Cannot redeclare Services_Twilio_autoload() (previously declared in /var/www/html/youDunFoundIt/craigslister/lib/twilio-php/Services/Twilio.php:9) in /var/www/html/youDunFoundIt/craigslister/lib/twilio-php/Services/Twilio.php on line 9

This is in plain PHP.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants