title: Apache2 configuration only execute PHP partially
body: <p>I am experiencing trouble while installing Apache2 on my Debian 8 VPS (jessie).
  I installed the website correctly on Hostinger, it works perfectly, but knowing Hostinger was a free plan, I moved to a sufficient VPS so I could get my hands dirty and do the job my myself. I now can handle everything, but the truth is, it's been a long time since I didn't use a debian server, and installing Apache seems harder than I thought.</p>
  
  <p>So, I secured my VPS as I wanted, that's not the problem, the site works correctly, but partially.</p>
  
  <p>I mean, on somes pages, the PHP code executes very well, it works with my database without any problem. I have a utils.php file that contains a <code>getBDD()</code> function like this one :</p>
  
  <pre><code>return new PDO("mysql:host=localhost;dbname=name;charset=utf8", "user", "password");
  </code></pre>
  
  <p>And it works on my main pages, I can request everything. You can see it here : <a href="http://mdjfeelzor.ovh/petiteancienne.php" rel="nofollow noreferrer">http://mdjfeelzor.ovh/petiteancienne.php</a> (the website is french).</p>
  
  <p>But I also have an ajax chat that needs a bit of PHP to work properly. Aaaand I don't understand why, but when I initialize my <code>$conn</code> with <code>getBDD()</code>, I am experiencing an issue further in the code.</p>
  
  <p>Look at that code :</p>
  
  <pre><code>include '../utils.php';
  
              session_start();
  
              if(isset($_POST['enter'])){
                  if($_POST['name'] != ""){
                      $_SESSION['name'] = stripslashes(htmlspecialchars($_POST['name']));
  
                      try {
                          $conn = getBDD();
  
                          $answer = $conn-&gt;prepare('SELECT * FROM openchats WHERE ip=? AND name=?');
                          $answer-&gt;execute(array(stripslashes(htmlspecialchars($_SERVER['REMOTE_ADDR'])),
                          stripslashes(htmlspecialchars($_SESSION['name']))));
  
                          if (!($data = $answer-&gt;fetch())) {
                              $req = $conn-&gt;prepare('INSERT INTO openchats (ip, name) VALUES (:ip, :name)');
                              $req-&gt;execute(array(
                                  'ip' =&gt; stripslashes(htmlspecialchars($_SERVER['REMOTE_ADDR'])),
                                  'name' =&gt; stripslashes(htmlspecialchars($_SESSION['name']))));
                          }
                      }
  
                      catch(PDOException $e) {
                          echo "Connection failed: " . $e-&gt;getMessage();
                      }
                  }
              }
  </code></pre>
  
  <p>It works correctly, right ? (it's supposed to work correctly on your machine) But the thing is, the code starts showing on my web page on the first call of <code>prepare()</code> as you can see here : <a href="http://mdjfeelzor.ovh/chat" rel="nofollow noreferrer">http://mdjfeelzor.ovh/chat</a></p>
  
  <p>So, I was wondering, what do you think is the problem ? Is it my way of programming that isn't working ? By the way, I'm using PHP5. I also tried the code <code>&lt;?php phpinfo(); ?&gt;</code> it works perfectly.</p>
  
  <p>Thanks for your help !</p>
  
  <p>EDIT : By the way, the code is shown but it is not supposed to enter in the condition, as <code>$_POST['enter']</code> doesn't exist on the first load, the code really works on my computer and on Hostinger so I think that the problem comes from Apache configuration ^^' and the AJAX code is not running at that point.</p>