Running external programs, how to run EXE in PHP
Sometimes the capabilities of the PHP language may not be enough, then you can rent or use your own server, where you can install any additional software.
Before starting to install and configure additional software, you should study PHP capabilities in more detail, maybe the required functionality is already in the language or some library. It is worth referring to official sources - a website, a forum, perhaps there will be a description of how to do this or that. If you still need specific functionality in PHP , then it can probably be done using third-party programs.
Such programs run on the server side. It is important to understand this and not to be confused with when programs are run on the client side. This is technically impossible for security reasons, you can confuse this if you are using a local server - then it will seem that the program is running on the client, but no, the program is launched on behalf of the server.
So, how to start data processing in an external program? First you need to select the desired program, install it and configure it correctly. When everything is ready, then you need to write a PHP script in your project that will interact with the program.
What functions does PHP have to run external programs ? There is a whole separate section on the official website - http://php.net/manual/ru/book.exec.php . All functions and their capabilities are described there. Some of the most requested features:
- exec - executes an external program,
- passthru - executes an external program and displays the raw output,
- system - Executes an external program and displays output.
Which function to use for launching is up to you, depending on your needs. If you just run the program, then the first, if you need to get the result of the program, then look at the others. You can just run the program, and it will output to a specific folder in the form of files, etc.
In order for the program to output data, you must first configure it, or develop your own, which will give data in the desired format. After running the program in this way from PHP, you can get the data and use it in PHP . And then you can do whatever you want with them.
What functionality can be implemented using external programs? It can be anything. For example, photo processing, document creation, video rendering, etc. In short, everything that can be done with a PC.
- 09.07.22IT / Misc Convert office files DOC, DOCX, DOCM, RTF to DOCX, DOCM, DOC, RTF, PDF, HTML, XML, TXT formats without loss and markup changes
- 07.07.22IT / Safety How to protect PHP, JS, HTML, CSS source code - obfuscation, minification, compression and encryption
- 06.07.22IT / Safety Connection not secure, problem with Lets Encrypt - how to fix expired 09/30/2021 DST Root CA X3, remove it manually and install ISRG Root X1. Example on MS Windows 7
- 08.07.21IT / Misc How to make a free translation for a website without an API, translate documents in Google Translate
- 06.07.21IT / Misc How to make a subscription button on a website, a subscriber base and automatic mailing