Location: PHPKode > projects > Easy Mac Apache PHP MySQL > php5.2.10/postinstall.php
#!/Applications/emamp/system/bin/php
<?php
//static class used to keep global connection to pdo
class pdo_global
{
  private static $conn;

  public static function dba()
  {
    if(is_null(self::$conn))
    {
      try
      {
      self::$conn=new PDO("sqlite:/Applications/emamp/system/emamp.sqlite3");
      }
      catch(PDOException $e)
      {
        trigger_error("Unable to connect to EMAMP sqlite database: ".$e->getMessage(),E_USER_ERROR);
      }
    }
    return self::$conn;
  }


}

$install=pdo_global::dba()->prepare("INSERT INTO modules (`name`,`manage`,`version`,`info`) VALUES ('php5.2.10','','1','PHP 5.2.10');");
$install->execute();
$module="php5.2.10";
$name="apache2cgiextensions";
$var="php5 php4 php php3 php2 phtml";

$vars=pdo_global::dba()->prepare("INSERT INTO variables (`module`,`name`,`var`) VALUES ('$module','$name','$var');");
$vars->execute();

$name="apache2cgi";
$var="Action php5210-cgi /php5210-cgi/php-cgi
AddHandler php5210-cgi *apache2cgiextensions*
ScriptAlias /php5210-cgi /Applications/emamp/php5.2.10/bin";
$vars=pdo_global::dba()->prepare("INSERT INTO variables (`module`,`name`,`var`) VALUES ('$module','$name','$var');");
$vars->execute();
#done
Return current item: Easy Mac Apache PHP MySQL