I recently started working on a Laravel project in my local development environment (MAMP, with PHP 5.4.3) and have been somewhat annoyed by an odd occurrence that doesn't seem to be documented.

Once in awhile, when I attempt to load a page, I get an unhandled exception screen instead, with the message "Directive 'allow_call_time_pass_reference' is no longer available in PHP." (The location listed is "Unknown on line 0.") If I reload the page once or twice, it works as expected. But the problem comes back shortly after. It's been doing it since I first ran Laravel, even before I added any of my own controllers or models.

I've tried commenting out allow_call_time_pass_reference in the PHP config, as well as explicitly setting it to be off (restarting the server after making changes, of course) but the intermittent warning continues to appear. It wouldn't be a big deal for production, I assume, since the setting to display errors would be off, but it's kind of annoying when working on the project locally.

Any ideas as to what could be causing this?

  • 1
    Looks like a known bug in PHP 5.4.3 - if you have MAMP Pro, you can switch PHP back to 5.3 easily. – Adam Hopkinson Oct 18 '12 at 16:50
  • @AdamHopkinson Do you have a link to the bug? – Glutexo Feb 10 '16 at 12:22
up vote 24 down vote accepted

According to PHP 5.4 Backward Incompatible Changes, Call time pass by references have been removed. Now because the error your getting says Directive and line 0 I'm lead to believe its an issue with your php.ini file, I'm sure if you open it up and comment out the line that says allow_call_time_pass_reference the error will go away. Hope that helps!

P.s. if your not sure where your php.ini file is you can find it by loading a page which calls phpinfo() and then searching for .ini

  • Commenting it out was the first thing I did. But your comment did lead me to the right solution. I checked phpinfo() and discovered that MAMP was using a different php.ini file than I expected. (It was MAMP/bin/php/php5.4.3/conf/php.ini instead of MAMP/conf/php5.4.3/php.ini.) Sure enough, it wasn't commented out in that location. – redwall_hp Oct 19 '12 at 0:21
  • 1
    Also, if you are in a shared hosting environment which is upgrading its PHP to 5.4 and running into this kind of problem try removing your local php.ini and using the default php.ini on the server instead. I had two web apps break as a result of a shared host's upgrade to PHP 5.4 and in both cases simply removing (renaming actually) the local php.ini file fixed the problem. – Tony Adams Feb 13 '14 at 14:02
  • I am trying to create project in zend framework and executed the command "zf create project quickstart" it is giving the same error.I tried to add comment "allow_call_time_pass_reference" in "C:\xampp\php\php.ini" But it didnt work.Can any one help me. I am using windows machine – kaustubh badamikar Nov 25 '14 at 7:30
  • @TonyAdams Tony, You really helped me solve my problem! Thanks so much for your comment. – camdixon Apr 26 '15 at 19:38

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.