[ Date Index ]
[ Thread Index ]
[ <= Previous by date /
thread ]
[ Next by date /
thread => ]
[LUG]Re: PHP working environment - easy development
- To: list@xxxxxxxxxxxxx
- Subject: [LUG]Re: PHP working environment - easy development
- From: Gordon Henderson <gordon+lug@xxxxxxxxxx>
- Date: Tue, 18 Jul 2023 12:10:35 +0100 (BST)
- Delivered-to: dclug@xxxxxxxxxxxxxxxxxxxxx
- Distribution: world
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dcglug.org.uk; s=1681290362; h=Content-Transfer-Encoding:Content-Type: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Help:List-Id: Subject:Reply-To:MIME-Version:References:Message-ID:In-Reply-To:To:From:Date: Sender:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Archive; bh=7MN+E3cMu+Nsz1EGr1vjYMd9jdPMOWLrSOpWm1/kyWI=; b=kgpnpiiE5l5xEiA6FAxQcs2wfO 2hI4y0CTOCPtgfbzFpdqI5lO3+H2W1XrKlNgFIUcfY0DTlhbIRIt/VrEn6N933kUHhk3TG02eR5bZ xiJKS3UjMBoXhhQI1pb5JeUJv8yKrhFYDnWme82iyeSq14xj5lm8zmjUnM+bA+6DmAlM=;
On Tue, 18 Jul 2023, rds_met wrote:
PHP being "inside out" as intersections in webpages (smart) seems to
have this problem of making it uniquely difficult to "fire it up" on
its own.
Am I missing something?
PHP is a general purpose programming language. It can be run from the
command line like most others - you don't need to run it inside a web
server/browser combo.
Simply start the file with
<?php
and end it with
?>
then
php filename
and it will run.
Anything outside those sections will be printed to the output with
variables expanded as usual.
You can do the usual "shebang" trick
#!/path/to/php
<?php
printf ("Hello, world!\n)
?>
This also prints Hello, World!
<?php
printf ("1+2=%d\n", 1+2)
>?
chmod +x filename
./filename
and off you go.
Gordon
--
The Mailing List for the Devon & Cornwall LUG
FAQ: https://www.dcglug.org.uk/faq/