Skip to main content

Installing, Configuring and Running PHP (via Command Line) on Windows; help by ChatGPT

Pelengkap (lagi) dr 2 Postingan sebelumnya:

Yg mengulas ttg Proses MengKompilasi

SUMMARY
1) INSTALLING PHP or Python via Command Line Interface (CLI) on Windows

2) CONFIGURING/PATH-SETTING (so that being able to run php or python from any folder):
  • Open Environment Variables in Windows
  • Add PHP or Python to your PATH variable 
  • How to check if PHP or Python is already in your PATH (before adding it /to avoid duplicates)

3) RUNNING a PHP/Python file via the Command Line Interface (CLI)


1) INSTALLING PHP or Python via Command Line Interface (CLI) on Windows

Guide to installing PHP and Python via Command Line Interface (CLI) on Windows, step-by-step, no GUI needed.

🐘 INSTALL PHP via CLI

1️⃣ Download PHP (latest stable version)

Open PowerShell (Run as Administrator) and run:

curl -LO https://windows.php.net/downloads/releases/php-8.3.12-Win32-vs16-x64.zip

(You can check the latest version at https://windows.php.net/download/)

2️⃣ Extract the ZIP file

mkdir C:\php
tar -xf php-8.3.12-Win32-vs16-x64.zip -C C:\php

3️⃣ Add PHP to PATH

setx PATH "%PATH%;C:\php"

Then close and reopen PowerShell or CMD.

4️⃣ Verify PHP installation

php -v

You should see something like:

PHP 8.3.12 (cli) (built: Sep 2025)

✅ PHP is ready for CLI use.

🐍 INSTALL PYTHON via CLI

1️⃣ Download Python (latest stable Windows installer)

curl -LO https://www.python.org/ftp/python/3.12.6/python-3.12.6-amd64.exe

(You can replace the version with the latest one from https://www.python.org/downloads/windows/)

2️⃣ Run the installer silently (no GUI)

Start-Process python-3.12.6-amd64.exe -ArgumentList "/quiet InstallAllUsers=1 PrependPath=1 Include_test=0" -Wait

🧩 This installs Python for all users and adds it to PATH automatically.

3️⃣ Verify Python installation

python --version

or

py --version

✅ You should see something like:

Python 3.12.6

🔧 Quick Summary Table

Tool Details Logo
PHP Download:
curl -LO https://windows.php.net/downloads/releases/php-8.3.12-Win32-vs16-x64.zip

Install Location:
C:\php

PATH Command:
setx PATH "%PATH%;C:\php"

Verify:
php -v
PHP Logo
Python Download:
curl -LO https://www.python.org/ftp/python/3.12.6/python-3.12.6-amd64.exe

Install Location:
C:\Program Files\Python312

PATH Command:
(auto)

Verify:
python --version
Python Logo

2) CONFIGURING/PATH-SETTING (so that being able to run php or python from any folder)

A. Here are several ways to open Environment Variables in Windows 👇

🧭 Method 1: Through System Properties

  1. Right-click on This PC (or My Computer) → select Properties.

  2. Click Advanced system settings (on the left sidebar).

  3. In the System Properties window, under the Advanced tab, click Environment Variables….
    ✅ This opens the Environment Variables window.


⚙️ Method 2: Using Windows Search

  1. Press Windows + S and type:

    environment variables
    
  2. Choose “Edit the system environment variables” or “Edit environment variables for your account.”


🏃 Method 3: From Run Command

  1. Press Windows + R

  2. Type:

    SystemPropertiesAdvanced
    
  3. Hit Enter → click Environment Variables button.


💻 Method 4: From Command Prompt / PowerShell

  • You can open the same window by running:

    rundll32 sysdm.cpl,EditEnvironmentVariables
    

    or

    SystemPropertiesAdvanced
    

    → then click Environment Variables.


2) CONFIGURING/PATH-SETTING (so that being able to run php or python from any folder)

B. How to add PHP or Python to your PATH variable (so you can run php or python from any folder)!

🧭 Method 1: Using the Windows GUI

✅ Steps:

  1. Press Windows + S and search for
    “Environment Variables”
    Then choose “Edit the system environment variables”.

  2. In the window that opens, click the Environment Variables… button.

  3. Under System variables, find and select Path, then click Edit.

  4. Click New, then add your folder path:

    • For PHP → C:\php

    • For Python → C:\Python39 (or whatever version you have)

  5. Click OKOKOK again.

  6. Restart Command Prompt or PowerShell for changes to take effect.

  7. Test it:

    php -v
    

    or

    python --version

⚙️ Method 2: Using Command Line

You can also add it via CLI (Command Prompt or PowerShell):

➤ For PHP

setx PATH "%PATH%;C:\php"

➤ For Python

setx PATH "%PATH%;C:\Python39"

(Replace C:\Python39 with your actual Python folder.)

After running that command, close and reopen your terminal.
Then test:

php -v

or

python --version


🧩 Quick Tip:

If PHP or Python is installed in a folder with spaces (like C:\Program Files\PHP), wrap it in quotes:

setx PATH "%PATH%;\"C:\Program Files\PHP\""

2) CONFIGURING/PATH-SETTING (so that being able to run php or python from any folder)

C. How to check if PHP or Python is already in your PATH (before adding it /to avoid duplicates)!

🧭 Method 1: Using Command Prompt

✅ Check current PATH

echo %PATH%

This will print a long list of folders separated by semicolons ;.
👉 Look through it and see if you can find:

  • C:\php

  • C:\Python39 (or another version, like C:\Users\<YourName>\AppData\Local\Programs\Python\Python312)

If you find one — that means PHP or Python is already in your PATH.


⚙️ Method 2: Using PowerShell (cleaner view)

Run:

$env:PATH -split ';'

This splits the PATH into one line per folder.
You’ll easily see if C:\php or C:\Python39 is listed.


🧰 Method 3: Check Directly via the Command

You can also test whether the command is recognized globally.

For PHP:

where php

For Python:

where python

If you get an output like:

C:\php\php.exe

or

C:\Python39\python.exe

✅ It means that program is already in your PATH.

If it says:

INFO: Could not find files for the given pattern(s).

❌ It means it’s not in PATH yet.


3) RUNNING a PHP/Python file via the Command Line Interface (CLI)

How to run a PHP file via the Command Line Interface (CLI) 👇

⚙️ 1. Make sure PHP is installed and in PATH

Test first:

php -v

✅ If you see version info (e.g. PHP 8.3.12), you’re ready.
❌ If not, check your installation or PATH variable (see previous steps).


📂 2. Navigate to your PHP file’s folder

Use cd (change directory). Example:

cd C:\projects\myapp

If your file is at C:\projects\myapp\test.php, you can also drag the folder into the terminal to auto-fill the path.


▶️ 3. Run the PHP script

Type:

php test.php

or use a full path:

php C:\projects\myapp\test.php

🧩 4. Optional: Make It Executable (with .bat wrapper)

If you want to run it like a normal .exe or command (without typing php each time):

  1. Create a new text file named run-php.bat

  2. Inside it, write:

    @echo off
    php "%~dp0yourfile.php" %*
    pause
    
  3. Save and double-click run-php.bat — it will execute your PHP file using PHP CLI.


💡 5. If the script outputs HTML (for web use)

You can preview it locally by running PHP’s built-in web server:

php -S localhost:8000

Then open http://localhost:8000 in your browser.

Comments

Popular posts from this blog

[ERROR BUG]
ChatGPT+Gemini: TikTok → Blogger Embed Converter using Cloudflare/Online Server

🔄 Refresh Page ERROR BUG: The connection is blocked because it was initiated by a public page to connect to devices or servers on your local network. Planning: Revise Program CODE Code USING Javascript/Online Server Code NOT USING Javascript Sample Working Code aka Already Repaired! Temporary Solution is by Asking AI Assistant to do REPAIR CODE of (Not yet Repaired) Current Conversion Program Code-Output TikTok Archive – Embedded Preview TikTok Embed ▶ View this video on TikTok ⚠️ DISCLAIMER: INPUT URL LIMITATION This program is currently restricted to processing Full Browser URLs only. It does not support TikTok’s mobile "short-link" format (e.g., vt.tiktok.com ). Required Action: Users must open the video in a web browser and copy the expanded URL from the address bar before pasting it into this program. URL Conversion Example ❌ UNSUPPORTED: https://vt.tiktok.com/ZSaXoFyov/ ✅ REQ...

Repost! Web-Based to Android Apps Convertion (MEDIAN.CO etc.)

CONTOH HASIL Android APK "PROGRAM" SAMPLE: Youtube and Instagram EMBEDded to Blogger/Blogspot.com SOURCE CODE Click this box to download Contoh Sample SHORTCUT-APPs "precise" click to download : median.co R8: ronin1985.blogspot.com R2M: ronin-manu.blogspot.com Gw udah coba Median.co utk mengubah Website gw menjadi Aplikasi Android Keren bet!! Median.co Cekidot Software lain yg mirip! ChatGPT : If you're looking for tools similar to Median.co to convert websites into Android apps, here are some top alternatives, especially for no-code or low-code users: 🔧 Best Tools Like Median.co to Convert Website to Android Apps 1. WebViewGold Platform: Windows/macOS (Xcode/Android Studio) Key Feature: Converts any website into iOS/Android app via WebView. Pros: One-time purchase Custom splash screen, push notifications Can open external links in external browser Cons:  Requi...

REPOST: Studying WATER PUMP by ROMAN ENGINEERING

*^ Ini yg Asli Gan! Mekanisme pada Concrete Pump: Kok ky Sistem Mekanik Romawi ya?! Tapi malah bisa HANYA pake PER aka bukan "MATA BOR look a like" Mekanisme Drill yg Cost Pembuatan bikin REPOT aka harus Tool SUPER Khusus Dari Material Besi yg digunakan terlihat langsung secara kasat mata Jauh Lebih Banyak drpd Per Biasa seperti yg ditunjukkan pd Video Alternatif dgn Penggunaan PER Video dr Instagram: Source: YouTube Rome's drainage machines #history #romanempire #engineering