How can a PHP script be executed on a page without reloading the entire page?

To execute a PHP script on a page without reloading the entire page, you can use AJAX (Asynchronous JavaScript and XML) to send a request to a separate PHP file that processes the script and returns the result. This allows you to update specific parts of the page dynamically without refreshing the entire page.

```php
// HTML code with a button to trigger the AJAX request
<button onclick="executeScript()">Execute PHP Script</button>
<div id="output"></div>

// JavaScript code to send an AJAX request
<script>
function executeScript() {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      document.getElementById("output").innerHTML = this.responseText;
    }
  };
  xhttp.open("GET", "script.php", true);
  xhttp.send();
}
</script>
```

In the above code snippet, when the button is clicked, the `executeScript` function sends an AJAX request to `script.php`. The PHP script in `script.php` can perform any desired operations and return the result, which is then displayed in the `output` div without reloading the entire page.