Script modified to OOP and now it doesn't work
<p>Basically I created this script that check if a file exists and then creates it.
It worked great before when I had a non OOP version of it. </p>

<p>Now I modified it to become OOP and somehow it doesn't work and I get the error in Apache <strong>PHP Fatal error:  Call to undefined function createFile() in C:\Program Files (x86)\Zend\Apache2\htdocs\Proj11\1.php on line 66</strong></p>

<p>I highlighted where line 66 is with the line <code>//// THE ERROR LINE BELOW</code></p>

<p>Whats wrong with it??? thx</p>

<pre><code>&lt;?php 
//DB Config File



$phase = $_GET['phase'];

if(empty ($phase)){
    $phase = new phase1();
    $phase-&gt;start();
    } elseif ($phase = 1) {
        $phase = new phase2();
    $phase-&gt;stepFunction();
        };

class phase1 {

    function __construct () {
        $dbFile = 'dbconfig.php';
        $step = 0;
        $username = $_GET['username'];
        $password = $_GET['password'];
        $server = $_GET['server'];
        $dbName = $_GET['dbName'];

        $this-&gt;step = $step;
        $this-&gt;dbFile = $dbFile;
        $this-&gt;username = $username;
        $this-&gt;password = $password;
        $this-&gt;server = $server;
        $this-&gt;dbName = $dbName;

        $db = new PDO ('mysql:host=' .$server.';dbname='.$this-&gt;dbName,$this-&gt;username,$this-&gt;password);

        $this-&gt;db = $db;
        }


public function createFile () {
        //Creates File and populates it.
        $fOpen = fopen($this-&gt;dbFile, 'w');
            $fString .= "&lt;?php\n";
            $fString .= "// Database Constants\n";
            $fString .= "\$DB_SERVER =" . "\"" . $this-&gt;server . "\";\n";
            $fString .= "\$DB_USER =" . "\"" . $this-&gt;username . "\";\n";
            $fString .= "\$DB_PASS =" . "\"" . $this-&gt;password . "\";\n";
            $fString .= "\$DB_NAME =". "\"" . $this-&gt;dbName . "\";\n";
            $fString .= "?&gt;";

        fwrite($fOpen, $fString);
        fclose($fOpen);

    return true;
}   


public function start (){

try {

if ($this-&gt;db) { //if succesful at connecting to the DB

if (file_exists($this-&gt;dbFile)){
    if (is_readable($this-&gt;dbFile) &amp;&amp; is_writable($this-&gt;dbFile)){ 

        //Creates File, populates it and redirects the user

  //////////////////////////
  //// THE ERROR LINE BELOW
  //////////////////////////

    if (createFile()) { 

        $phase = new phase2();
        $phase-&gt;stepFunction($this-&gt;step);
         exit ();
            }


        } else { 

        echo "The file {$dbFile} cannot be accessed. Please configure the file manualy or grant Write and Read permission.";  }

    } else {

        //Creates File, populates it and redirects the user

    if (createFile()) {


        $phase = new phase2();
        $phase-&gt;stepFunction($this-&gt;step);
         exit ();
            }

        }


}

} catch (PDOException $e) { //Catchs error if can't connect to the db.
    echo  'Connection failed: ' . $e-&gt;getMessage();
}

}
    } // en class Phase 1
</code></pre>
