Recently I'm programming a website and I want to prevent my source code from being seen.
I tried famous Guards like Zend or ionCube but I understood that Encoded Code can be decoded easily.
Now I want to develop an Extension to Decode the code at runtime.
I have a Problem.
When the extension runs and the code processes how to return the code to php to be processed?
You want to write an extension. You will need to know C.
Refer to: http://devzone.zend.com/article/1021 and http://www.php.net/manual/en/internals2.php
Related
Is there any way to minify (or remove comments) in PHP using Visual Studio 2015? I use PHP Tools and when i release php scripts to public server, i would like at least remove all comments from code. I know, is there way to remove comments with content menu, but i wish to have comments in my project and no comments (or minimal and unread code) in publish scripts (some like Bundler & Minifier tool, but for php). Thanks
There is basically no point in minifying Php since there is no performance gain in doing so. Although if you insist, there are a few ways to remove comments/whitespaces from source. (and these are not limited to just VisualStudio) -
Use Gulp.
Use Command line options: php -w file.php => generates file without comments & whitespaces. Equivalent to php_strip_whitespace()
Use Regular Expression in Find-Replace Function of your IDE. You can use the following inside Find FieldBox. (and keep Replace fieldbox empty)
//.* or /.
Use a Library/tool like Php-Minify
Hope that helps!
Why aren't you going to use online tool to do it?
There are many online tools you can use instead of VS 2015.
Here is one tool for you.
http://beta.phpformatter.com/
Hope it helps you and check this answer as solved if it helps you.
Thanks!
You can check Comment Remover tool to remove all the comments from a file with a single button click. It also remove #regions and preserve XML Doc comments.
I think there is no tool for visual studio to do this. But you may use external tools to do the job. It's a common task to do this in build system like jenkins. The build system e. g. is able to react on many version control events.
But I also think that you want to make php code unreadable (like compiling). There are only a few options to hide your php code to other people. You could use ionCube for encrypting php files. But then you have to make sure, that the ionCube extension is also installed on the public web server. Also, ionCube is currently not available for php 7.2, only up to 7.1. Another option is to compile php code using HipHop, a PHP to C++ compiler engine: https://de.wikipedia.org/wiki/HipHop
What I Am Trying
I am building a Codeigniter application for a client.I need to upload the codeigniter application in the client server. Therefore I need to encrypt or protect my source files.
What I Require
What should I do to protect or encrypt my Codeigniter source file or Project.
Well that would take away the whole point of open source now would it.
You will have to encrypt/obfuscate your source by using ionCube or Zend encoders.
However, I am not sure if the app will work after encoding since you are using a framework.
ionCube says that they work with codeigniter but I don't have any experience for it.
I haven't used Zend before.
Even though you encrypt them I have seen posts where they claim to be able to get the normal clean code. I don't know how much of this is true.
But if you need to protect the source code ionCube or Zend encoders say that they can.
http://www.ioncube.com/ OR http://www.zend.com/en/products/guard/
i also needed this type of feature and all users suggest ioncube and ZendGuard but this software is paid versions. so research on this feature i get a such a perfect tool and it's allow to make only single PHP file encoding as i want i use this.
after implement this encoded code in my project no affect to code and works perfectly and it is Byterun.
There are problems in ionCube. The problem is when CodeIgniter code is obfusacate and encrypted, the calling area of that function/class/variable does not recognize newly created function/class/variable name and generates error.
ionCube knows the pitfalls and offers a way to exclude such files that are being called outside that file, but thats what MVC do. Not an elegant solution by ionCube.
https://blog.ioncube.com/2014/10/16/common-obfuscation-pitfalls/
I did not check ZendGuard, but my guts feelings says, the same problem will appear if we use any code encryption tool. The point is, we made a file, class, method, variable encrypt and obfuscate (encrypt / obfuscate), after the process, it will produce new name for class, method, variable. Now, another model, controller, method is calling the same variable/method, and then it will not recognized and an error will be thrown. I am not 100% sure in case of ZendGuard or other tools but checked the ionCube.
As in JSP we give "WAR" file to clients and it contains .class files and other configuration files but not the source code, is there any way, in PHP, to deliver the project (website) to client without giving them source code.
Facebook created a project called HipHop php, a php compiler.
See this post:
Can you "compile" PHP code?
Short answer, not really.
I mean you can compile php into a single .phar file however anyone with moderate php knowledge can get the code from that.
There are also solutions http://www.ioncube.com/ though I don't know how easily someone can get the code from it however I would strongly advise against any solution like this as they generally require the user of this "compiled" code to you their proprietary software to run it.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
PHP as a Desktop Programming Language
I have developed a sales application with php (codeigniter framework). i am using xampp to run this application in local PC's browser. now i want 2 things:
is there any way to run this application as a desktop application? something like an icon will open the app and run without any browser. also without xampp to be set up.
also i want to protect the code from unauthorized using. someone can easily copy the code and run it on other computer. i want to prevent this.
please help me about these issues. thanks in advance.
PHP is not really suitable for either of these things. You're going to need a browser either way, but you could if you really wanted to use some kind of custom browser (e.g., you can use Java or .NET to create a window that has a basic browser page with only whatever controls you want to add on it rather than a full browser).
You won't be able to prevent people copying it, but you could try googling for a PHP obfuscator to make the code hard to read and you could add whatever checks you may wish to determine the PC is one you've approved (perhaps some kind of license file and you could activate it against a MAC address or something).
You can use PHP/GTK+ to create a PHP Desktop Application, but the code protection is very difficult, you can try ofuscating the code, or you can use a php compiler like this: http://www.phpcompiler.org/
I would not use php to develop a desktop application as you like, try using another language, dont use scripting, use compiled codes.
Luck with you project.
PHP is a recursive acronym which stands for "PHP: Hypertext Preprocessor." At its core, PHP is designed to process information and output it as HTML ("Hypertext"). If you wish to output information primarily as something other than HTML, PHP is probably the wrong language.
PHP is also a scripting language. That means that it is not compiled (converted from source code to machine code). As such, the scripts are human-readable. Tools such as phc exist, but if you want a compiled application, PHP is probably the wrong language.
Can you use PHP as a desktop application? Yes. Can you compile PHP? Yes. Should you? Probably not, because you are circumventing the purpose and features of the language.
If you are interested in writing client-side applications with PHP, you have to use PHP-GTK. I don't know how flexible is that. In any case, you should try it to see what it can do for you ;)
hi i am new in php,i made the whole code in c++ and want to use this code in php.so i made dll to my code for using it.but i am not able to use this dll in php ,can anybody send me the complete code to use php,c++ extensions.
There's a whole section about some php internals and how to write/build a php extension in the online manual at http://php.net/internals2, and I especially want to point out the description of the ext_skel script there as it helps you to set up a new "empty" extension project.
And there are alos tools like SWIG that help you to wrap existing libraries into extensions for numerous languages including PHP.
I made a PHP extension in C++ using SWIG. The PHP specific documentation can be found here.
Since very few online documentation is avaible on using the Zend API I also recommend the book Extending and Embedding PHP.