need extension clarification

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

need extension clarification

Postby jfburns@codeplex » September 11th, 2006, 1:42 pm

I'm looking at the myproject.config file and I'm curious about what extensions I can enable. There are two sections in particular:

<!-- Native extensions that are parts of PHP (built-in) yet not parts of Phalanger -->
...


<!-- Native extensions distributed with PHP -->
...

Can I use "Native extensions distributed with PHP"? I tried to enable one of them but it didn't load so I'm guessing not? :(

Thanks!
jfburns@codeplex
 
Posts: 15
Joined: January 7th, 2012, 8:57 pm

RE: need extension clarification

Postby Lada Prosek » September 11th, 2006, 3:01 pm

You can use both kinds of extensions.

The extensions marked as Native extensions that are parts of PHP (built-in) yet not parts of Phalanger are those that are normally built-in in PHP, which means that in PHP you won't find them in the form of .dll files and you don't have to enable them in any way (and there's also no way how to disable them). Until we reimplement some rarely used or very sophisticated functions (e.g.jdtojewish for conversions from Julian to Jewish calendar), we decided to make them available through the managed-native wrapper layer just by compiling these parts of PHP into .dll files.

On the other hand the extensions marked as Native extensions distributed with PHP are those that you can find as .dll files in PHP distributions. This means that you have to explicitly enable them in PHP just like you do in Phalanger.

There's no technical distinction between these two categories, it's more about the logical difference between the stuff that is considered built-in and separate. You can use both. Sorry for the confusion.

Which extension did you unsuccessfully try to enable?
Lada Prosek
 
Posts: 47
Joined: January 7th, 2012, 8:52 pm

RE: need extension clarification

Postby jfburns@codeplex » September 11th, 2006, 5:25 pm

Thanks for the response,

Take this sample code and configuration for example:

project.config:

<add assembly="php_curl.mng, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4ef6ed87c53048a3" section="curl" />

project.php:

<?php

if(!functionexists('curlinit'))
exit('You must have Curl compiled/loaded into PHP for this to work.');

?>

compile command:

phpc /config:bin\project.config /target:exe /lang:PHP5 batch/project.php && c:\project\bin\project.exe

output of project.exe:

You must have Curl compiled/loaded into PHP for this to work.
jfburns@codeplex
 
Posts: 15
Joined: January 7th, 2012, 8:57 pm

RE: need extension clarification

Postby jfburns@codeplex » September 11th, 2006, 5:27 pm

Just so you know, it looks like this forum software took out the underscore character that should be within "function exists" and "curl init".
jfburns@codeplex
 
Posts: 15
Joined: January 7th, 2012, 8:57 pm

RE: need extension clarification

Postby Lada Prosek » September 11th, 2006, 8:30 pm

Oh, I see. The list of imported class libraries is used at compile time as well as run time.The phpc /config option does not influence the latter. When you run the .exe, php-curl is not loaded and so the test fails. I admit that it is a bit weird. In fact, I should add a low priority task to the issue tracker.

Solution: console application use the machine wide configuration (machine.config burried under the \Windows directory) plus their own configuration, which must be named something.exe.config, where something.exe is the .exe, and must reside in the same directory. So one way to deal with this is to create this something.exe.config with the appropriate classLibrary/add node.

There's also a somewhat neater solution that consists just of not using /config but instead naming the configuration file App.config and placing it to the directory from which phpc is executed. When phpc compiles a console/windows app and sees a file named App.config in the current directory, it not only uses this file just as if /config was used, but it also copies the file to the target directory and names it something.exe.config.
Lada Prosek
 
Posts: 47
Joined: January 7th, 2012, 8:52 pm

RE: need extension clarification

Postby jfburns@codeplex » September 11th, 2006, 8:38 pm

Well, mostly good news.

I added the call to Machine.config and the extension is loaded now. I still don't know why it wouldn't properly load from my project.config file even though the compiler said that the config file was being read and that the extension was loaded.

Thanks, I'm going to continue testing this out!

Jack

jfburns@codeplex
 
Posts: 15
Joined: January 7th, 2012, 8:57 pm

RE: need extension clarification

Postby jfburns@codeplex » September 11th, 2006, 8:47 pm

I didn't see your post until after mine =)

App.config works as you described. I'm off to try MySQL now.

Cheers!
jfburns@codeplex
 
Posts: 15
Joined: January 7th, 2012, 8:57 pm

Re: need extension clarification

Postby ricardok1 » September 8th, 2012, 4:01 pm

Hi there,

Anyone can post a global example how to use / declare the extensions?

I'm trying to build a Console App. I have include "php_com.mng.dll" and (after some build errors to duplication of declarations of the dll in the resource/project file) I still don't have the access to the class.

I try :

$this->objApp = new COM("Outlook.Application");

And running the code gives this error:

Error: Call to undefined external function 'COM::com', extension 'php_com' (extension not found).

Anyone can help? Any full example how to use a natural extension of php?
Similar problem?

Thanks
Ricardo
ricardok1
 
Posts: 2
Joined: September 8th, 2012, 12:47 am

Re: need extension clarification

Postby Jakub Misek » September 8th, 2012, 11:32 pm

Hi,

Do you have
Code: Select all
<add assembly="php_com.mng, Version=3.0.0.0, Culture=neutral, PublicKeyToken=4ef6ed87c53048a3" section="com" />
in your app.config file?
Using this native PHP4 extension should be possible, but it runs only in 32bit and it has worst performance.

However with Phalanger, you can access .NET Outlook object directly
Code: Select all
$app = new Microsoft\Office\Interop\Outlook\Application();
(you need to reference Microsoft Outlook 11.0 Object Library)
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 54 guests

cron

User Control Panel

Login

Who is online

In total there are 54 users online :: 0 registered, 0 hidden and 54 guests (based on users active over the past 5 minutes)
Most users ever online was 440 on April 26th, 2024, 12:59 am

Users browsing this forum: No registered users and 54 guests