> PDF error
Phalanger PHP ASP.NET
Error: pdf_set_info(): PDFlib error: [2602] PDF_set_info: Code page ’936′ not supported
一般在平台无关的测试下,需要使用host 的encoding,
在PDF_set_info之前需要调用如下函数:
PDF_set_parameter($pdf, “hypertextencoding”, “host”);
一般不推荐使用该函数。
> 用CSC生成EXE文件
D:\My Documents\Visual Studio 2010\Projects\phpasp\phpasp>csc /r:”c:\Program Files\Phalanger 2.1\bin\PhpNetCore.dll” /out:Program.exe Program.cs
> 用CSC生成EXE文件
D:\My Documents\Visual Studio 2010\Projects\phpasp\phpasp>csc /r:”c:\Program Files\Phalanger 2.1\bin\PhpNetCore.dll” /out:Program.exe Program.cs
C:\Inetpub\wwwroot\test\test2>csc.exe /reference:”c:\Program Files\Phalanger 2.1\Bin\PhpNetCore.dll” /out:test.exe /target:exe /appconfig:App.config test.cs
> 把PHP生成DLL文件
C:\Inetpub\wwwroot\test\test2>phpc /target:dll /out:ClassLibrary.dll Library.php ClassC.php
> 把PHP生成DLL文件,用于WEB
phpc /target:web /root:. /recurse:. /out:Bin /static+ /debug-
/target:web Phalanger compiles whole page into WebPages.dll module
/recurse:. Phalanger will precompile recursively whole directory and its subdirectories
/static+ means to use static includes optimization
/debug- tells the compiler to generate more optimized code and not to generate debugging information (pdb files) WordPress installation
>多种脚本混用,把PHP当成DLL用于ASP
http://wiki.php-compiler.net/Multi_Script_Assembly
Multi Script Assembly is created whenever user builds PHP scripts in legacy mode (default) as a DLL (/target:dll).
phpc /target:dll /root:. /recurse:. /out:bin/msa.dll
Using MSA
Scripts from precompiled ScriptLibrary can be used then easily in your projects. You can include scripts in PHP language or in your C# project. To setup script library into Phalanger compiler&runtime, add following configuration into your .config file:
<phpNet>
<scriptLibrary>
<add url=”bin/msa.dll” />
<!– or –><add assembly=”msa, Version=1.0.0.0″ />
</scriptLibrary>
</phpNet>
This will load the script library into the Phalanger compiler&runtime. You can then include scripts from precompiled assembly msa.dll like as they would be on your file system.
In PHP project
Simply setup your script library as it is described above and use standard include statement to include scripts from script library. Note scripts in script libraries has priority over scripts on file system.
include ‘file.php’;
In C# (and any other .NET language) project
Setup your script library as it is described above. Then you can include scripts into Phalanger runtime, this will execute the script, declare functions and classes and initialize global variables that are used within the script. Example follows:
CODE:
var context = PHP.Core.ScriptContext.CurrentContext; // Phalanger execution context (note: thread static)
context.Include(“file.php”, false); // run the script from script library
// use context to obtain local variables/constants/functions/types/…
Using standard PHP library from C# and other .NET languages
http://wiki.php-compiler.net/Code_Samples/Standard_mode_interoperability
> IIS add ASP.NET4
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe /r
开始安装 ASP.NET (4.0.30319) 并更改 IIS 配置以使用此版本的 ASP.NET。
………
已完成安装 ASP.NET (4.0.30319),并已更改 IIS 配置以使用此版本的 ASP.NET。
> 当以APP或WEB APP为项目时,要有原来的由PHP生成的DLL文件,放到相应的BIN目录或根目录,或提供PHP源代码在相应目录。
> 当以WEB SITE为项目时,发布网站后,无需原来的PHP生成的DLL文件,但生成网站时,要在网站相应目录提供PHP生成的DLL文件。
或生成网站时,提供PHP源代码在相应目录。
同时,生成网站时,webconfig文件里的phpnet节要有PHP生成的DLL文件引用行;