Where can I find instructions for compiling Ming? Google is confused and thinks I am looking for pages about MinGW (the C++ lib for Windows) when in fact I want this:
http://www.php.net/manual/en/book.ming.php (a PHP lib for creating SWF files)
I currently have Wamp Server installed. I checked the option php_ming, but Ming still did not work. I finally found out that even though Wamp is adding the right line to the php.ini file, the actual file it refers to "php_ming.dll" does not exist on my computer.
It also does not appear to exist on the Internet (at least not on any safe looking website). So, apparently, I must compile it from scratch. Compiling in C is very difficult for me, because I do not understand why so many different types of files and configuration options are required, which files to get, where to get them, and where to put them.
I get DOT C files (programs) and DOT H files (includes), but I quickly get lost with DOT O files, "linker" files, command line options - and all the specifics which must be exactly right for any compile to work. For this reason, I am looking for instructions on how to compile Ming for PHP/Windows. Where can I find this?
Related
I got a problem with an API (PHP) I created. The API should create a pdf document depending on the data that is sent. The script works perfectly, running it directly on Ubuntu, Plesk is running on.
The part that is not working is the following:
$cmd = sprintf("pdflatex -interaction nonstopmode %s", escapeshellarg(file));
exec($cmd, $foo, $ret);
The tex-file seems not to be touched... no log files or anything.
Any ideas about this?
Thank you
Latex is usually run by experienced users either raw on the command line or via IDE with console interaction, since there is often the need to see from console feedback why a compilation may fail.
The Simplest check for checking is PdfLaTex installed? is at the system console to enter pdflatex --version this should confirm at least a minimal pdflatex has been found in the environment path and show the variant after a rough value for the level of pi.
So in this case responded pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian)
When trying to run unseen it is not easy to get feed back so the smallest test with a small known sample is again at the console to run in a current working directory with batch mode :-
pdflatex -interaction=nonstopmode sample.tex
This should run with little need for checks, however if the paths to pdflatex are not configured you may need to add the location of the pdflatex executable. Thus you discovered needed /usr/bin/pdflatex -interaction=nonstopmode file.tex
There are many different dependencies in LaTeX packages and modules that require the "env" settings be well defined in terms of inter-related paths (e.g. to support files etc.) so it is worth checking those out from the extensive documentation.
Some modules may require elevation to escape shell restrictions via -shell-escape and the above command may need temporary elevation for one run (it should not be needed constantly) so only include when you know exactly from documentation why a module requires it.
It is tempting for TeX novices to think there is an advatage to use sub folder in a working directory for "chapter and verse", since the working directory may "look" cluttered by potentially dozens of runtime files, however much of LaTeX depends on very specific relative pathing and the best way to avoid errors is not need to keep redefining images or other components by variables, simply say it is in the same folder.
Likewise for the packages they should also be set to a fixed location by means of env variables i.e. for bin folder and fonts and other modular supporting components. It is worth reviewing https://tug.org/texlive/quickinstall.html and note the section about minimal path definition but there is much more than that basic setting required by post installed components
I cannot figure out the proper ./configure options to use when giving the configure command if I would like to have something be shared (thus creating an .so extension) as well as stating a directory where required libraries are.
Example:
--with-openssl=shared will create a .so file
--with-openssl=/home/username/local will compile directly into the php build.
How do I state both? I see this nowhere in the php docs.
I am installing on a linux Ubuntu.
Well, I found it through trial and error as well as a few other posts of people going through different troubles that had their ./configure commands visible.
In my example case there are two flags you need:
--with-openssl=shared --with-openssl-dir=/home/username/local
In other instances there is no extension-name-dir flag, so you do comma separated values:
--with-cron=shared,/home/username/local
I could find no easy way to tell you which ones are which, but trial and error got me through these two that I needed. In the case of GD you actually need as many as four separate ones for the needed library support:
--with-gd=shared --with-jpeg-dir=/home/username/usr --with-png-dir=/home/username/usr --with-freetype-dir=/home/username/usr
Hope this helps someone else, I could find no other discussions about this issue (hard to believe there was no SO answers already).
If I would like to distribute PHP application with installer(package system of OS) how should I proceed? I don't want PHP files to be there, just working application, so when I type 'app' into console, it ends up being launching application, without need to install PHP on system(no php installation on host required). I would also like the application to have patch-able byte-code, so it's in parts, loaded when needed and only part needs to be replaced on update.
What I would do now is following:
->Compile PHP with extensions for specific platform.
->Make binary application which launches '/full/php app' when app is launched.
->Pack it in installer in a way, that there would be binary added to path when added, launching specific installation of PHP which is alongside the app with argument of start point->App would be running.
Problem is:
Maybe I don't want my PHP files to be exposed(in application, there will be available source anyway) is there some ready made stuff to do this? Is there some better way than I proposed?
Alternative: Modifying OP Cache to work with "packing" application to deliver byte codes to modified OP Cache which just reads the cache.
My suggestion would be a tiny tool I just finished, for almost exactly the same problem. (Oh yes I tried all the others but they're old and rusty, sometimes they're stuck with 4.x syntax, have no support, have no proper documentation, etc)
So here's RapidEXE:
http://deneskellner.com/sw/rapidexe
In the classical way, it's not a really-real compiler, just a glorified packer, but does exactly what you need: the output exe will be standalone, carrying everything with it and transparently building an ad-hoc runtime environment. Don't worry, it all happens very fast.
It uses PHP 7.2 / Win64 by default but has 5.x too, for XP compatibility.
It's freeware, obviously. (MIT License.)
(Just telling this because I don't want anyone to think I'm advertising or something. I just took a few minutes to read the guidelines about own-product answers and I'm trying to stay within the Code of the Jedi here.)
However...
I would also like the application to have patch-able byte-code, so it's in parts, loaded when needed and only part needs to be replaced on update.
It's easier to recompile the exe. You can extract the payload pieces of course but the source pack is one big zip; there seems to be no real advantage of handling it separately. Recompiling a project is just one command.
Maybe I don't want my PHP files to be exposed(in application, there will be available source anyway)
In this case, the exe contains your source compressed but eventually they get extracted into a temp folder. They're deleted immediately after run but, well, this is no protection whatsoever. Obfuscation seems to be the only viable option.
If something goes wrong, feel free to comment or drop me a line on developer-at-deneskellner-dot-com. (I mean, I just finished it, it's brand new, it may misbehave so consider it something like a beta for now.)
Happy compiling!
PHP doesn't do that natively, but here are a few ideas:
Self-extracting archive
Many archival programs allow you to create a self-extracting archive and some even allow to run a program after extraction. Configure it so that it extracts php.exe and all your code to a temp folder and then runs ir from there; deleting after the script has complete.
Transpilers/compilers
There's the old HPHC which translates PHP code to C++, and its wikipedia age also contains links to other, similar projects. Perhaps you can take advantage of those.
Modified PHP
PHP itself is opensource. You should be able to modify it withot too much difficulty to take the source code from another location, like some resource compiled directly inside the php.exe.
Use Zend Guard tool that compiles and converts the plain-text PHP scripts into a platform-independent binary format known as a 'Zend Intermediate Code' file. These encoded binary files can then be distributed instead of the plain text PHP. Zend Guard loaders are available for Windows and Linux platform that enables PHP to run the scripts encoded by Zend Guard.
Refer to http://www.zend.com/en/products/zend-guard
I would like to add another answer for anyone who might be Googling for answers.
Peach Pie compiler/runtime
There is an alternative method to run (and build apps from) .php source codes, without using the standard php.exe runtime. The solution is based on C#/.NET and is actually able to compile php source files to .NET bytecode.
This allows you to distribute your program without exposing its source code.
You can learn more about the project at:
https://www.peachpie.io/
You've got 3 overlapping questions.
1. Can I create a stand-alone executable from a PHP application?
Answered in this question. TL;DR: yes, but it's tricky, and many of the tools you might use are semi-abandoned.
2. Can I package my executable for distribution on client machines?
Yes, though it depends on how you answer question 1. If you use the .Net compiler, your options are different to the C++ option.
3. Can I protect my source code once I've created the application?
Again, depends on how you answer question 1. Many compilers include an "obfuscator" option which makes it hard to make sense of any information you get from decompiling the app. However, a determined attacker can probably get through that (this is why software piracy is possible).
I've PHP project, so till now I've been using Intellij IDEA for both Java and PHP without any problem. But now, I've an old PHP project, the project uses HTML files as a PHP files. I mean files with HTML extensions contain PHP code.
However IDEA doesn't recognize them as a PHP file, but when I change extension to PHP it shows everything is fine.
So how can I force IDEA to accept HTML files as PHP files?
Is there any workaround ?
Go to File > Settings > File Types (under IDE Settings).
Under Recognized File Types, find PHP files (PHP) (assuming you're using the PHPStorm plugin as I am, if not find where your *.php file extension is registered). If you click on this, then look at Registered Patterns, you will see all file patterns that will be recognized as PHP files. You can click the green + on the right-hand side of the patterns pane, and it will ask for a file-name pattern to recognize as a PHP file. Enter *.html (or something more specific if your HTML files all follow a similar naming pattern). When you hit OK, it will likely say that *.html is already registered with HTML Files. Go ahead and reassign it, then hit OK on the Settings window. Your *.html files will now be recognized as PHP files instead of just HTML files.
I just tested this out in 12.0.4 and it works as I described above.
Do note, however, that this seems to be an IDE-wide setting, and isn't project specific. This unfortunately means that you will have to re-register *.html with HTML Files when opening your other, newer project with the correct file extensions. This is why I suggested a more specific pattern than *.html if your files allow for it, or if you can change the filenames to allow for that.
The most up-to-date way of doing this in IntelliJ can be found here.
I need to call a Perl script from a PHP file, and I've gotten as far as know that I need the Perl class, and that it's in the php_perl.dll extension. I've also downloaded the php_perl package from PECL, but as you know, it's just the source and needs to be compiled. I don't work in C, so compiling it's not really an option -- I tried downloading Visual Studio Express but I still can't seem to make it happen.
So I really need php_perl.dll, but http://pecl4win.php.net/ext.php/php_perl.dll just tells me that "The pecl4win build box is temporarily out of service. We're preparing a new build system." Surely there must be SOMEWHERE else I can get the DLL, but I can't seem to find it. Every link I find seems to either be someone else looking for it, or a warez-looking site that wants you to give them your credit card info.
Thanks...
---- Nick
The Internet Archive Wayback Machine results look promising, perhaps one of the links will lead you to the file (although they often take such binary files out of the archive).
EDIT: I was able to get the DLL for the older branch php-5.0.5 (5_0) that way and uploaded it here (removed). Or try the direct link.
Looking for the newer branch php-5.1.6 (5_1) however gave no results so far, I checked the 4 most recent dates.
EDIT2: Found another working link for branch php-5.1.2.
The sidebar
says to use the following repository until the new buildsystem is online:
http://downloads.php.net/pierre/