Skip to content
Advertisement

Why do I still get xAMP errors after fixing my PHP code and saving the file?

This question applies to several types of coding errors, from leaving dollar signs off the front of PHP variables to forgetting to put a semicolon between statements, to leaving unmatched braces and quotation marks. I make lots of stupid typos that result in errors.

When I read the apache error log to find out what I did wrong, then go back and fix the errors, and save the file and reload the page to see if it works, sometimes I have to restart apache to get the new code to execute.

For example, if I write “SEELCT * FROM MyTable”, try to load the page, get an error, correct the SQL to “SELECT * FROM MyTable”, save the file and refresh the page in my browser, sometimes my error-handling code will still show the typo in the old SQL statement. After I restart Apache, everything works fine.

Is there a PHP or Apache setting that would allow me to get the correct results as soon as I fix my code and save it?

Advertisement

Answer

You may need to disable opcache. Open your php.ini (Xampp control panel -> first config button -> php.ini) and find the line contain opcache.enable= and change its value to 0. If it is not, add new line:

opcache.enable=0

Then restart apache only 1 more time. You could also try to clear the browser cache after all.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement