Using App_Code

Discussion about the open-source Phalanger [?] project.

Using App_Code

Postby Dewey » July 9th, 2013, 11:39 pm

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.
Dewey
 
Posts: 6
Joined: July 9th, 2013, 11:34 pm

Re: Using App_Code

Postby Jakub Misek » July 10th, 2013, 12:25 pm

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.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Using App_Code

Postby Dewey » July 10th, 2013, 6:03 pm

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?
Dewey
 
Posts: 6
Joined: July 9th, 2013, 11:34 pm

Re: Using App_Code

Postby Jakub Misek » July 10th, 2013, 6:30 pm

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.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Using App_Code

Postby Dewey » July 10th, 2013, 10:55 pm

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>
Dewey
 
Posts: 6
Joined: July 9th, 2013, 11:34 pm

Re: Using App_Code

Postby Jakub Misek » July 11th, 2013, 10:07 am

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" />
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Using App_Code

Postby Dewey » July 13th, 2013, 8:55 am

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 :(
Dewey
 
Posts: 6
Joined: July 9th, 2013, 11:34 pm

Re: Using App_Code

Postby Jakub Misek » July 13th, 2013, 9:59 am

wow :) I've totally forgot about all the IIS 6 catches.
Thanks for sharing your solution, I hope it helps other people as well.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 1 guest

cron

User Control Panel

Login

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 124 on September 25th, 2020, 6:57 am

Users browsing this forum: No registered users and 1 guest