Installation

  1. To install the extension, download the package, extract it into Phalanger's installation folder.
  2. Install binaries by running "install-mysql.cmd". This will add the assemblies to .NET GAC (Global Assembly Cache) using gacutil tool.
  3. Then you can use the extension with any Phalanger compiled application by including a reference on it in the .config file. Add following XML configuration into your machine.config or web.config, into section <configuration><phpNet><classLibrary>:
<add assembly="PhpNetMySql, Version=3.0.0.0, Culture=neutral, PublicKeyToken=2771987119c16a03" section="mysql"/>
<!-- PDO MySQL driver, requires PhpNetPDO extension to be loaded as well -->
<add assembly="PhpNetPDOMySql, Version=3.0.0.0, Culture=neutral, PublicKeyToken=2771987119c16a03" section="pdomysql"/>
Notice: remove usage of native mysql extension, if you were using it.

Configuration

You can configure the MySQL extension directly in your .config file as follows:
<configuration>
  <phpNet>
    <!-- Reference to the extension assembly -->
    <classLibrary>
      <add assembly="PhpNetMySql, Version=3.0.0.0, Culture=neutral, PublicKeyToken=2771987119c16a03" section="mysql"/>
    </classLibrary>

    <!-- Optional configuration -->
    <mysql>
      <!-- Default server for mysql_connect() function. -->
      <set name="Server" value="" phpName="mysql.default_host" />

      <!-- Default port for mysql_connect() function. -->
      <set name="Port" value="3306" phpName="mysql.default_port" />

      <!-- Default user for mysql_connect() function. -->
      <set name="User" value="" phpName="mysql.default_user" />

      <!-- Default password for mysql_connect() function. -->
      <set name="Password" value="" phpName="mysql.default_password" />

      <!-- Connection timeout. Negative value or zero means no timeout. -->
      <set name="ConnectTimeout" value="60" phpName="mysql.connect_timeout" />
	
      <!-- 
        Limit for the number of simoultaneous connections that the application can establish.
        Negative value means no limit.
      -->
      <set name="MaxConnections" value="-1" phpName="mysql.max_links" />
    </mysql>

  </phpNet>
</configuration>

Building the sources

Download and extract the source files to $/Source/Extensions/MySql, where $ is the root of the Phalanger source tree. Build Phalanger first, then build the MySql.sln solution. Files are added into GAC automatically during the build process.

Last edited Mar 7, 2013 at 11:53 AM by jakub, version 7

Comments

kielsoft May 27, 2011 at 12:39 PM 
For the Current Version 2.1 and Phalanger 2.1 use

<add assembly="PhpNetMySql, Version=2.1.0.0, Culture=neutral, PublicKeyToken=2771987119c16a03" section="mysql"/>