need extension clarification
9 posts
• Page 1 of 1
need extension clarification
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!
<!-- 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
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?
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
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.
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
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
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.
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
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
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
I didn't see your post until after mine =)
App.config works as you described. I'm off to try MySQL now.
Cheers!
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
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
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
Hi,
Do you have
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
Do you have
- Code: Select all
<add assembly="php_com.mng, Version=3.0.0.0, Culture=neutral, PublicKeyToken=4ef6ed87c53048a3" section="com" />
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();
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
9 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 13 guests