• $

PHP Not Working? 8 Ways to Fix It (For Apache, XAMPP, HTML)

“Why is my PHP not working!?” If you have ever found yourself in a situation where you needed to ask that question, you know how frustrating problems with PHP can be. Everything seems in place; you have done all you are supposed to do but still - nothing.

To help you get over this problem, in this tutorial we will go over common reasons why PHP might not be working for you as it should. We will look at a couple of cases that you might encounter in different circumstances and also provide solutions for how to get back on track. Hopefully, we will be able to help you with your issue.

PHP File Not Working on an Apache Server

The first case we want to look at is when you have a PHP file that is not executing on an Apache server. This can result in several different kinds of behavior.

Maybe when you try to open it in your browser, you get a download prompt instead. Maybe the PHP source code shows up directly in the browser window. The latter case is even worse because it may pose a security risk to boot; besides being annoying.

Either way, what is supposed to happen is not happening, which is to run the PHP script. When that is the case, you have a number of different ways of trying to address it.

Make Sure PHP Is Installed and Running Properly

When PHP is not working on your server, the first thing to do is check if it’s even present and available. You cannot execute anything written in PHP if the programming language is not even installed on the server. Sounds stupid and basic but it happens.

How can you check this?

If you have access to the command line, you can simply type in php -v to see if it returns the version information of your PHP installation.

Someone from India
recently purchased Multi-school system 1 hour ago   Verified by Master & Visa Card

WhatsApp
Chat with us