Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is PHP not always a server side technology? [closed]

Tags:

php

In the FAQ section of the PHP manual, I came across this:

Since Javascript is (usually) a client-side technology, and PHP is (usually) a server-side technology...

I understand what they mean about Javascript, but in what other contexts can PHP be used?

like image 441
Don't Panic Avatar asked Jan 23 '14 16:01

Don't Panic


Video Answer


2 Answers

There are three main areas where PHP scripts are used.

  1. Server-side scripting. This is the most traditional and main target field for PHP. You need three things to make this work. The PHP parser (CGI or server module), a web server and a web browser. You need to run the web server, with a connected PHP installation. You can access the PHP program output with a web browser, viewing the PHP page through the server. All these can run on your home machine if you are just experimenting with PHP programming. See the installation instructions section for more information.
  2. Command line scripting. You can make a PHP script to run it without any server or browser. You only need the PHP parser to use it this way. This type of usage is ideal for scripts regularly executed using cron (on *nix or Linux) or Task Scheduler (on Windows). These scripts can also be used for simple text processing tasks. See the section about Command line usage of PHP for more information.
  3. Writing desktop applications. PHP is probably not the very best language to create a desktop application with a graphical user interface, but if you know PHP very well, and would like to use some advanced PHP features in your client-side applications you can also use PHP-GTK to write such programs. You also have the ability to write cross-platform applications this way. PHP-GTK is an extension to PHP, not available in the main distribution.

Source -http://www.php.net/manual/en/intro-whatcando.php

like image 68
Rohan Avatar answered Oct 28 '22 14:10

Rohan


I've used it before with http://www.bambalam.se/bamcompile/ to create standalone .exe's.

For tossing something quick together without any libraries, and just a single .exe, it's absolutely awesome. It doesn't support PHP 5 which is kind of a drag, but cool regardless.

like image 23
snollygolly Avatar answered Oct 28 '22 15:10

snollygolly