Page 1 of 1

Using App_Code

PostPosted: July 9th, 2013, 11:39 pm
by Dewey
I tried your example on CodeProject, and for some reason, I get the error below.

Camels created:
Fatal error: Class 'Class1' not found in C:\Inetpub\vhosts\IVCBIZSYSTEMS.COM\subdomains\CMS\httpdocs\script.php on line 6

However, when I new up a Class1 in ASP.Net, it's there.

I'm running .Net 4.0 on Windows Server 2003 with PHP 5.2x

Any suggestions would be helpful.

P.S. I also can't run the web sample, however, I'll comment on that existing thread.

Re: Using App_Code

PostPosted: July 10th, 2013, 12:25 pm
by Jakub Misek
Noting if you are using PHP, Class1 from .NET cannot be definitely there.

Ensure you are running Phalanger to handle *.php files instead of PHP.

Re: Using App_Code

PostPosted: July 10th, 2013, 6:03 pm
by Dewey
Jakub Misek wrote:Noting if you are using PHP, Class1 from .NET cannot be definitely there.

Ensure you are running Phalanger to handle *.php files instead of PHP.


Let me see if I understand you. I have regular PHP enabled, so of course it doesn't understand Class1. So are you saying that I need to disable regular PHP, and enable Phalanger to handle the php files?

If so, where do I enable Phalanger? Is there a config file?

Re: Using App_Code

PostPosted: July 10th, 2013, 6:30 pm
by Jakub Misek
what is your web server?

By default, .php files are handled by php-cgi.exe ... which has nothing to do with Phalanger.

.php files should be handled by PhpNetCore.dll.

The configuration depends on your web server - on IIS, it is defined in web.config file placed in the root of your web application.

Re: Using App_Code

PostPosted: July 10th, 2013, 10:55 pm
by Dewey
Here is the configuration file in the sample that I'm using. It appears that it's assuming I'm on IIS7, but I'm on IIS6, so there's no integratedMode, does that make a difference?

BTW,
1. Are you sure that php-cgi.exe will be overridden by the handler in the config file?

2. Should there be any Phalanger DLL in the bin directory?

Code: Select all
<?xml version="1.0"?>
<configuration>
  <system.webServer>
    <handlers>
      <!-- handle PHP scripts by Phalanger: -->
      <add name="Phalanger Handler" path="*.php" verb="*" type="PHP.Core.RequestHandler, PhpNetCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=0a8e8c4c76728c71" resourceType="Unspecified" preCondition="integratedMode"/>
    </handlers>
  </system.webServer>
  <!-- Phalanger configuration: -->
  <phpNet>
    <classLibrary/>
    <scriptLibrary/>
  </phpNet>
  <system.web>
    <compilation debug="true">
      <assemblies>
        <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>
  </system.web>
</configuration>

Re: Using App_Code

PostPosted: July 11th, 2013, 10:07 am
by Jakub Misek
Indeed :) IIS 6 has different configuration for request handling.

I think it is following
Code: Select all
<system.web>
    <httpHandlers>
      <add verb="*" path="*.php" type="PHP.Core.PageFactory, PhpNetCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=0a8e8c4c76728c71" />

Re: Using App_Code

PostPosted: July 13th, 2013, 8:55 am
by Dewey
Jakub Misek wrote:Indeed :) IIS 6 has different configuration for request handling.

I think it is following
Code: Select all
<system.web>
    <httpHandlers>
      <add verb="*" path="*.php" type="PHP.Core.PageFactory, PhpNetCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=0a8e8c4c76728c71" />


You were close, but since you never answered my question about who was executing the php files, there was no way to really resolve the problem.

The answer was that while I had real php executing the *.php files, this was NEVER going to work.

I happened to google the problem and found this - http://wiki.php-compiler.net/Web_Server_configuration/IIS_6.0

This resource said that I needed to configure IIS to let aspnet_isapi.dll handle all php files.

Once I did that, magically, the Camels sample was working and Class1 was easily found!

I hope this helps others, and I've only been able to get wpdotnet working on IIS7, but that was EASY compared to the time spent on this which I thought was going to be easier :lol:

Anyway, thanks for your help, and I'm sure that most people are using IIS7 these days, I just have to deal with older deployments :(

Re: Using App_Code

PostPosted: July 13th, 2013, 9:59 am
by Jakub Misek
wow :) I've totally forgot about all the IIS 6 catches.
Thanks for sharing your solution, I hope it helps other people as well.