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.
- IT / Misc 08.07.21 How to make a free translation for a website without an API, translate documents in Google Translate
- IT / Misc 06.07.21 How to make a subscription button on a website, a subscriber base and automatic mailing
- Food / Misc 06.07.21 How to quickly cook delicious fried pies with potatoes and onions
- IT / Misc 04.07.21 Caching - create, load and reset. Where to store the cache, methods and types of caching
- IT / Database 03.07.21 Custom NoSQL - storing data in files and not only in a database. Storing settings, small data and caching files