How to create PHP executable program?

Asked

Viewed 1,312 times

8

Is it possible to create a program for my company that is executable, only with PHP and Mysql? Or I will need other languages such as C, Java, etc. In case the program is internal only.

3 answers

16


Yes, it’s possible. It has a huge list of PHP compilers that generate executables. Many don’t even exist anymore. Their level of quality is variable, and in practice "nobody" uses it. Some:

Why are there so many? Because no one is good :) One tries to fix the fault of the other. I just don’t give details because it’s not the focus.

Want to make an application "Nterprise"? At least think about Hack that you were created for this, but not so much. In fact, don’t use a hammer just because you think screws look like nails, so it would be a good solution. Choose a language suitable for the problem, PHP is a language of script. And someone denied the answer because I say this, it seems "fla-Flu" from Facebook where the person does not want to see the obvious.

Se você só tem um martelo todos os problemas parecem pregos

In fact if what you’re doing is not a backend web, don’t even think about PHP. If you’re thinking about an application where web is clearly not the best solution, you’ve already chosen the wrong one. And most applications are not suitable for web. It is again the problem of hammer and nails. The person only knows how to use the hammer, so she thinks every problem is a nail, that is, should be web, even when it does not give any significant advantage and brings disadvantages. It is what I have seen these days on the use of modinhas, even those that last decades and are extremely popular, and override the business need by the will or (in)ability of the developer.

For what PHP was created, ie sites and applications that need to be web even, since not very complex, there does not need executable.

As a complement, do not use PHP-GTK.

  • 1

    I know my comment is useless from the point of view of the platform parameters, but I had to say that "don’t use a hammer just because you think bolts are like nails" turned into a mantra now.

  • @Shutupmagda and what his comment means?

  • It’s... As my comment is ambiguous, it’s only fair that I say I think it’s a good thing :D

  • 4

    @Shutupmagda this is even more ambiguous :D

  • our.. lady.. of the loose bit...

  • @Camilayamamoto ?!?!?!

Show 1 more comment

10

PHP is an interpreted, not compiled language. Its purpose is not to generate desktop applications, but to pre-process HTML.

It is even possible to build a desktop application with PHP (see examples in the other answers), but it seems to me a lot of a gambiarra. If your goal is to create a desktop application, it is best to use a language/framework that is geared towards it.

Another thing is, we don’t really know what you want to do. If you have a back-end with PHP and Mysql and a web front-end, to turn it into "executable PHP" is to throw away the whole front-end and redo it. For example, when you are suggested to use PHP-GTK, you would have to redo the entire user interface with GTK and throw away everything that is HTML, CSS, JS. Is that really what you want? More likely - and simple - is that you just want to wrap up a web front end as a desktop application. For this has several tools, as the Electron and the nw.

  • I get it, I think my program might work in the browser. But thank you!!

  • I fully agree with the answer, but if you are interested, with such a framework/lib it is possible to create p/ desktop apps with PHP. - http://gtk.php.net/

  • Depending on what he understands as executable, by his comment it may be possible to create by PHP, it will not be a Desktop app, but it will certainly be an app "executable". :-)

  • 1

    @Sidon Adding what he says in the title and post, I think he wants both things: a desktop application compiled as executable.

  • @Lucascarvalho If you want to use web technology but create an executable, there are options that are basically programmable browsers, like Electron and nw. Take a look at them, maybe that’s the case.

  • @bfavaretto, for real. The other day I used a solution with a webapp Django, I created an app in chome (a full window link with no address) the guys were satisfied. :-)

  • Desktop is falling into disuse, except for very specific situations.

  • 2

    @Sidon means marketing is beating engineering, right? They are making horrible applications, with numerous disadvantages, for zero gain or near this. Desktop is not falling into disuse where there are people thinking about the problem and not following the herd. People are satisfied with crap, so they’re able to sell web where it doesn’t fit. Of course web fits in a lot of things, I went the other day to do something that I even accepted a bad application just to not have to install anything on the machine since I was going to use it once. Wanted an OS app p/ Windows, this transcends web.

  • 4

    @Mustache is the conversation we have often. For more than 10 years, many have insisted that the path is applied in the browser, and reality shows the opposite, detonating this speech. Just see that virtually every serious application for producing or managing content and data is native or desktop. For example, ERP and the like, a market where online compete by leveling down, and even text mode applications from 30 years ago are often more serious than what we see online today. I say with peace of mind that in the next 10 I will still be able to support the thesis. I remembered this: http://bit.ly/2s7QuP5

  • @bigown, I agree in terms, eheheh, if the promise of rich applications so propagated some 4 or 5 years ago were to materialize I would agree, but honestly, I think with the tools available for desktop, only for very specific cases

  • Complementing... I never agree with "bad app", whether web or not. :-)

  • 3

    @Sidon you and anyone has the right to have whatever opinion you want, but and put two well-made applications, a GUI and another web to the same users, will see the difference in productivity and comfort of both. Note that you don’t even have an argument in your comment. In a way, if the application is not suitable for the web and was made like this it is bad by definition. The problem is that whoever did it thinks it’s not bad, and won’t think differently or prove to him it’s worse.

  • 3

    I want to make it clear that a web application running as a desktop, ie without a normal web browser, I even find acceptable in many cases. It’s just a different GUI, but it ends up having the Feel desktop and think that one day will match the quality of the native GUI. In normal browser, it will never come close.

  • 1

    Right @bigown, I think that on this "board" would be difficult to argue, even though I think it would break the rules, but the subject is interesting, I usually say that in our area "absolute certainties" is not very useful, so I like the debate, if you want we can create a chat about it. :-)

  • 1

    @Sidon why I hate this absolute certainty that the industry has adopted that web is better than desktop, and has studies that show that it is not unless in the cases that it really is, but everyone has gone to adopt web as standard and say "desktop, only for very specific cases"when there is no evidence that this should be done, on the contrary, it is not ideal. Debating is good, not arguing is bad.

  • 5

    Nor is it worse or better, but it is appropriate for each situation. Example: I would not like to download an executable to interact with an application that I use 2 times in life to fill out 10 form lines, but I would not like to rely on a browser and internet for my customer registration that I use daily, throughout time, especially if you need to install 200 plugins in order to use my peripherals (it’s worse than downloading a single executable). It’s the old story, hammer is used on nail, key is used on screw, knife is used to cut cheese and not to open PC cabinet.

  • 3

    truth be told: this adoption of web by default started pq almost all desktop applications are bad. So you have to fix the right problem. What you do is change the problem. As all web applications suffer from the same problem, people were slowly accepting the deficiencies and hj lost criticality. Of course there is still the problem that many web applications "that satisfy customers" have more than the inherent problem of the web, they are absurdly poorly made and would fail resoundingly 20 years ago.

  • I was going to ask a question about which cases of the web application vs which cases of the desktop application, so I found this question (and its answers): https://answall.com/q/187344/64969; cc @Sidon

Show 13 more comments

-8

Quick response

1 - Take PHP for Desktop and put a Wordpess with the Sqlite plugin, works until the last version 5.xx and ready, will have a fantastic core as skeleton.

2 - Use Python to serve PHP scripts locally, simple.httpServer, then through Pip install pyexec to generate the executable in the chosen folder of php scripts, it is so easy to use that there is no need for further explanations, basically consists of serving PHP with the Python server itself, this way you manipulate text, shell, bat etc, infinite possibilities, da para controlar mesmo o cooler.

Don’t talk about technologies you don’t know

It’s not just possible, it’s extremely easy. I don’t have time for forums, but due to such ignorance and nonsense said on this page, I felt obliged to deny these DEVS ("current programmers of Xuxa pc now call themselves Devs").

I created not just a script, but a complete hybrid operating system using PHP, PYTON, and SQLITE with packaging for Debian Linux with less than 300 MB running everything from Tom Czarek’s PHP for Desktop, the problem with physical access and low-level language, was solved with PHP triggering Python, better than the most advanced of the sad Chromebooks, because there are no problems with video drives, common in such systems, and that also affects PHP for Desktop, and then the latter, just use Pywebview.

Forgive the foul language, it would take much more than a field of commentary to explain 25 years of work in technologies that few give value, or know how to use the correct form or their full potential, I am not nostalgic or twist to language this or that, but when you realize that you can do almost anything with just Python and PHP, for those who want to truly master a language, this is the holy God, because to devote to different frameworks and technologies, is to condemn yourself to be average for the rest of your life, time is worth much more than that.

You won’t hear anything more absurd than PHP being a language for the web, so Rasmus Lerdorf thought, time balls, I’ll put this shell function(shell_exec() & exec()) for embellishment, maybe one day serve for something, the interpretation of CGI then serves to make bread.

When a person says that PHP is not for making robust software, or is some supporter who works for free for frameworks, or has no idea how a computer interprets commands. There are some applications that may be more suitable than PHP for ease and development time, but not for lack of PHP capability to perform such a task.

We have to learn to value more men like Rasmus Lerdorf and systems like Linux, more than half of this forum would not be able to afford an OS license if the software monopoly were as it is on the web today for Google.

If you have difficulty, put a skeleton ready for you to see how it works, have a good day.

  • The conversation went on and on moved to the chat and anyone interested in reading or adding something, can click on the link provided.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.