Using compiled WebPages.dll without source files
10 posts
• Page 1 of 1
Using compiled WebPages.dll without source files
I have been trying to find information on this since yesterday - there is not one single bit of text describing this option anywhere on the web as far as I can see.
I have deployed Phalanger 3.0 successfully on IIS 7.5
It runs php files no problem.
I have compiled a WebPages.dll sitting in the /bin folder in my application.
Now, I'd like to remove my source files and have WebPages.dll to take over all processing, until I recompile them again. Basically Im trying to protect the source code by only leaving the .dll on the server.
I have tried including following in my web.config in the root of my application, however this has had no effect:
As soon as I remove my source .php files, IIS complains it cannot find the file.
What should I do to complete this?
I have deployed Phalanger 3.0 successfully on IIS 7.5
It runs php files no problem.
I have compiled a WebPages.dll sitting in the /bin folder in my application.
Now, I'd like to remove my source files and have WebPages.dll to take over all processing, until I recompile them again. Basically Im trying to protect the source code by only leaving the .dll on the server.
I have tried including following in my web.config in the root of my application, however this has had no effect:
- Code: Select all
<paths>
<set name="DynamicWrappers" value=".\Dynamic"/>
<set name="Libraries" value=".\Bin"/>
<set name="ExtWrappers" value=".\Bin"/>
<set name="ExtNatives" value=".\Bin\Extensions"/>
</paths>
<compiler>
<set name="Debug" value="true" />
</compiler>
As soon as I remove my source .php files, IIS complains it cannot find the file.
What should I do to complete this?
- papachumba
- Posts: 7
- Joined: December 18th, 2012, 12:49 pm
Re: Using compiled WebPages.dll without source files
There is phpc.exe help at http://wiki.php-compiler.net/Phpc.exe
Hiding script files on your server is possible in this way, WebPages.dll will contain all your (compiled) .php files, so inclusion and requesting these scripts will work. File system functions won't.
Hiding script files on your server is possible in this way, WebPages.dll will contain all your (compiled) .php files, so inclusion and requesting these scripts will work. File system functions won't.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Using compiled WebPages.dll without source files
Hi Jacob, thank you for your prompt answer.
I understand phpc.exe will compile my scripts into a WebPages.dll, i have managed to do this ok.
Problem is, as soon as I remove the original .php scripts, IIS complains with "404 file not found", meaning IIS is not loading WebPages.dll, instead it is trying to load the original .php file.
How can I prevent it from doing this?
I understand phpc.exe will compile my scripts into a WebPages.dll, i have managed to do this ok.
Problem is, as soon as I remove the original .php scripts, IIS complains with "404 file not found", meaning IIS is not loading WebPages.dll, instead it is trying to load the original .php file.
How can I prevent it from doing this?
- papachumba
- Posts: 7
- Joined: December 18th, 2012, 12:49 pm
Re: Using compiled WebPages.dll without source files
WebPages.dll has to be placed under /Bin/ folder of your web application root.
Does it work for you?
Thanks,
Does it work for you?
Thanks,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Using compiled WebPages.dll without source files
Yes, the folder is in correct place but still not working?
If I browse to http://server/quotes/myfile.php it executes.
If i remove myfile.php and browse to http://server/quotes/myfile.php i get 404 file not found
this is my directory structure
If I browse to http://server/quotes/myfile.php it executes.
If i remove myfile.php and browse to http://server/quotes/myfile.php i get 404 file not found
this is my directory structure
/quotes (web application)
/quotes/myfile.php
/quotes/web.config
/quotes/Bin/WebPages.dll
- papachumba
- Posts: 7
- Joined: December 18th, 2012, 12:49 pm
Re: Using compiled WebPages.dll without source files
Maybe because the file was loaded, recognized as most recent (so the compiled image from webpages.dll was ignored), and then removed ...
Try to remove the file, restart the apppool and request it again ... Phalanger should see the only option in WebPages.dll and use this one for sure.
Also take a look on following options (web.confing/phpNet/compiler) (sample in latest sources at \Deployment\Web.config) which may save some resources and ensures only scripts compiled in your DLL will be loaded:
Thanks,
Try to remove the file, restart the apppool and request it again ... Phalanger should see the only option in WebPages.dll and use this one for sure.
Also take a look on following options (web.confing/phpNet/compiler) (sample in latest sources at \Deployment\Web.config) which may save some resources and ensures only scripts compiled in your DLL will be loaded:
- Code: Select all
<set name="WatchSourceChanges" value="false" />
<set name="OnlyPrecompiledCode" value="true" />
Thanks,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Using compiled WebPages.dll without source files
Thank you so much, adding these 2 lines has helped!
I wasnt able to make it work with the .php file totally removed, however, if I edit the php file, and remove ALL code from the file and then save, it seems like IIS is reading the .dll (as it is giving me the output in the browser still)
So, it seems to be working if I manually empty the php file and resave under same name. If i delete the php file, IIS starts complaining...
I wasnt able to make it work with the .php file totally removed, however, if I edit the php file, and remove ALL code from the file and then save, it seems like IIS is reading the .dll (as it is giving me the output in the browser still)
So, it seems to be working if I manually empty the php file and resave under same name. If i delete the php file, IIS starts complaining...
- papachumba
- Posts: 7
- Joined: December 18th, 2012, 12:49 pm
Re: Using compiled WebPages.dll without source files
Well
<set name="OnlyPrecompiledCode" value="true" />
disallows reading scripts from file system for sure.
However you should be able to delete .php files, and still get requests served - this would be some IIS settings, maybe set mime type, or something. Once it gets into Phalanger, it will be loaded from webpages.dll.
Anyway I'm glad it works for you!
<set name="OnlyPrecompiledCode" value="true" />
disallows reading scripts from file system for sure.
However you should be able to delete .php files, and still get requests served - this would be some IIS settings, maybe set mime type, or something. Once it gets into Phalanger, it will be loaded from webpages.dll.
Anyway I'm glad it works for you!
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Using compiled WebPages.dll without source files
Thanks for your prompt help Jakub.
I have managed to sort it all out, my mistake.
When I setup the handler mapping under this new site, I put in a "request restriction" to only invoke the handler when a request is mapped to file/folder.
As soon as I removed this restriction, the website would serve the file even when I removed the PHP source files...
All working beautifully now!
I have managed to sort it all out, my mistake.
When I setup the handler mapping under this new site, I put in a "request restriction" to only invoke the handler when a request is mapped to file/folder.
As soon as I removed this restriction, the website would serve the file even when I removed the PHP source files...
All working beautifully now!
- papachumba
- Posts: 7
- Joined: December 18th, 2012, 12:49 pm
Re: Using compiled WebPages.dll without source files
Great! Thanks for letting us know!
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 22 guests