PHP version: info  

XAMPP portable WEB & MariaDB Server

for PHP server scripting on Windows 10 64 bit

2021.10.30 PHP 8.0.12 xampp-portable-windows-x64-8.0.12-0-VS16.7z 89.12 MB,
2020.03.30 PHP 7.4.3 (Laragon is still on PHP 7)
https://www.apachefriends.org/faq_windows.html 
or http://localhost:8083/dashboard/faq.html 
http://localhost:8083/dashboard/howto.html 

http://localhost:8083/ 

http://dev1:8083/ 


SyMenu -> xampp-control.exe called as admin -> click button "Shell" to open Win CLI
J:\xampp>php -v
PHP 8.0.12 (cli) (built: Oct 19 2021 11:21:05) ( ZTS Visual C++ 2019 x64 )
Copyright (c) The PHP Group
Zend Engine v4.0.12, Copyright (c) Zend Technologies

J:\xampp>composer selfupdate
Upgrading to version 2.1.10 (stable channel).
Use composer self-update --rollback to return to version 2.0.8

J:\xampp>composer -v
Composer version 2.1.10 2021-10-29 22:34:57

1. C:\Windows\System32\drivers\etc\hosts

localhost name resolution is handled within DNS itself.
```
128.127.0.0.1 localhost dev1 https://www.expressvpn.com/
::1 localhost dev1 https://www.expressvpn.com/
```

2. J:\xampp\apache\conf\httpd.conf

Listen 8083
ServerName localhost:8083

...
To see http://dev1:8083/fwphp/www/ (dev1 is apache virtual host) :
```xml
<Directory "J:/awww/www/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
```

Now in J:\xampp\xampp-control.exe :
1. buttons "Config", "Editor" and "Service and port settings" Apache port 8083
2. buttons "Start mysql" and "Start Apache"

http://localhost:8083/ shows :
Apache Friends Applications FAQs HOW-TO Guides PHPInfo phpMyAdmin

3. J:\xampp\phpMyAdmin\config.inc.php

change line to be $cfg['Servers'][$i]['host'] = 'localhost'; (not 127.0.0.1 !)
buttons "Stop mysql" then "Start mysql"
http://localhost:8083/phpmyadmin/ shows Server: localhost
Databases :
1. information_schema
2. mysql
3. performance_schema
4. phpmyadmin
5. test

my db-s imported
Click "Import" link in top toolbar
1. J:\\awww\\www\\01_DDL_mysql_blog.sql


To see http://dev1:8083/fwphp/www/ (dev1 is apache virtual host) :

4. J:\xampp\apache\conf\extra\httpd-vhosts.conf :

First VirtualHost section is default or fallback virtual host,
used f or all requests that do not match **ServerName or ServerAlias**
in any \<VirtualHost> block.
```xml
<VirtualHost *:8083>
DocumentRoot "/xampp/htdocs/"
ServerName localhost
</VirtualHost>
sets up a virtual host named dev1
<VirtualHost *:8083>
DocumentRoot "J:/awww/www/"
ServerName dev1
</VirtualHost>
```

Self signed certificate comes with xampp :
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"

To see https://dev1/fwphp/www/ (dev1 is apache virtual host) :

5. J:\xampp\apache\conf\extra\httpd-ssl.conf

SSL Virtual Host Content

```xml
<VirtualHost _default_:443>

DocumentRoot "J:/awww/www"
ServerName dev1:443
ServerAdmin slavkoss22@gmail.com
ErrorLog "J:/xampp/apache/logs/error.log"
TransferLog "J:/xampp/apache/logs/access.log"

SSLEngine on

SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"

<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "J:/xampp/apache/cgi-bin">
SSLOptions +StdEnvVars
</Directory>

BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0

CustomLog "J:/xampp/apache/logs/ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>



<VirtualHost _default_:443>

# General setup for the virtual host
DocumentRoot "J:/xampp/htdocs"
#ServerName www.example.com:443
ServerName localhost:443
#ServerAdmin admin@example.com
ServerAdmin slavkoss22@gmail.com
ErrorLog "J:/xampp/apache/logs/error.log"
TransferLog "J:/xampp/apache/logs/access.log"

# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on

SSLCertificateFile "conf/ssl.crt/server.crt"

SSLCertificateKeyFile "conf/ssl.key/server.key"

<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "J:/xampp/apache/cgi-bin">
SSLOptions +StdEnvVars
</Directory>


BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0

CustomLog "J:/xampp/apache/logs/ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>
```




## 6. Developing dev1 web site is virtual host, port 8083, dir J:/awww/www
I put all my php coding in J:/awww/www, ehich is on Github. In J:\xampp\htdocs are some extern (big) applications for testing.

 

Laragon portable WAMP Server

1. Info

laragon.7z ver. 4.0.14, 19 MB - PHP 5.4, MySQL 5.1 - easy to add newer tools eg php-7.4.22-nts-Win32-vc15-x64.zip - see below.

LARAGON_ROOT is J:\awww above www dir (my local (home PC) web server first document root).

Current document root (may be more, see Menu -> www -> Switch document root) :
$_SERVER['DOCUMENT_ROOT'] =

https://github.com/leokhoa/laragon - download.  See links at end of this script.

Can Install WordPress using Laragon's "quick create" feature.

C:\WINDOWS\system32\drivers\etc\hosts  should have line :
127.0.0.1 localhost dev1 
or mysite instead dev1. This is needed for web server to know how to reach web site in URL :   http://dev1...

 

2. New versions of Laragon WAMP Server SW tools

2.1 Add another PHP version :

  1. https://windows.php.net/downloads/releases/ or "archives" subfolder (ie https://windows.php.net/downloads/releases/archive ) eg
    php-7.4.22-nts-Win32-vc15-x64.zip 26 MB 
    php-7.4.10-nts-Win32-vc15-x64.zip, 26 MB

    where x64 means 64-bit,  xx86 means 32-bit, nts means Non Thread Safe - it is more efficient, see below or :
    https://stackoverflow.com/questions/1623914/what-is-thread-safe-or-non-thread-safe-in-php .


  2. Extract downloaded to: {LARAGON_ROOT}\bin\php\php-7.4.22-nts-Win32-vc15-x64
    where my LARAGON_ROOT is J:\awww (above www my local web server doc. root).
  3. Select new version at: Laragon Menu >PHP> Version > php-7.4.22-nts-Win32-vc15-x64

If something's wrong, check and install correspond VC Redist (VC11, VC14, VC15...).

 

2.2 Add another Apache version

  1. https://www.apachelounge.com/download/VC14/binaries/
    eg 01_httpd-2.4.48-win64-VS16.zip 10 MB  httpd-2.4.46-win64-VC15.zip, 10MB
  2. Extract downloaded to: {LARAGON_ROOT}\bin\apache\httpd-2.4.46-win64-VC15.zip
  3. Changes in J:\awww\bin\apache\httpd-2.4.48-win64-VS16\conf\httpd.conf :

    Optional :  Listen 8083 instead Listen 80

    <Directory />
       # original : AllowOverride none
       # original : Require all denied
       Options Indexes FollowSymLinks
       AllowOverride All
       Require all granted
    </Directory>

    <Directory "J:/ylaragon/www">
       ...
        # AllowOverride None
       AllowOverride All
       ...

    <Directory "${SRVROOT}/cgi-bin">
       #AllowOverride None
       #Options None
       #Require all granted
       Options Indexes FollowSymLinks
       AllowOverride All
       Require all granted
    </Directory>
  4. Optional : Enable SSL so : Laragon menu link at top of Laragon window (or right click on Laragon window) -> Apache -> SSL
  5. Select new version at: Laragon Menu > Apache > Version >httpd-2.4.46-win64-VC15.zip

 

 

2.3. Virtual host - no need for home development

Why no need : See Menu -> www -> Switch document root - any dir on PC may contain PHP, HTML... scripts which can be executed - I added dir J:\ylaragon\www\ for testing,
J:\awww\www is my developing dir, my production site is demo site - free hosting with free Mysql :
On Linux : http://phporacle.eu5.net/ (freehostingeu - fast, stable, has free MySQL) .

  1. Menu -> Preferences -> General tab - you can change your projects directory and you can set domain for virtual host name eg: {project_name}.me. By the default host name is http://project_name.dev.

  2. When you create new folder in Document Root folder of laragon, laragon automatically creates virtual host. if you want see the project with virtual host
    click "Menu" button -> select www, now you can see your project with virtual hostname. click hostname to navigate in the browser.

 

 

2.4 Add another Nginx version - NOT WORKING FOR ME (lot of "Bad Gateway" errors, then stopped)

Nginx port change : Menu -> Nginx -> Sites enabled -> 00-default.conf

  1. http://nginx.org/download/ eg nginx-1.19.2.zip, 1.7 MB !!
  2. Extract downloaded to: {LARAGON_ROOT}\bin\nginx\nginx-1.19.2
  3. Select the new version at: Laragon Menu > Nginx > Version > nginx-1.19.2

 

2.5 Add another MariaDB  or MySQL version

  1. https://dev.mysql.com/get/Downloads/ MySQL-5.7/mysql-5.7.18-winx64.zip
    Extract the downloaded to: {LARAGON_ROOT}\bin\mysql\mysql-5.7.18-winx64

    See below Note for MariaDB - I use it :
    https://downloads.mariadb.org/mariadb/ eg mariadb-10.5.5-winx64.zip, 70 MB

    Select new version at: Laragon Menu > MySQL > Version > mysql-5.7.18-winx64

    Note: If you use MariaDB, extract it to: {LARAGON_ROOT}\bin\mysql\mariadb-10.5.5-winx64 Laragon will automatically create correspond DataDir for MariaDB on data/mariadb

 

2.6 Add phpMyAdmin 01_phpMyAdmin-4.9.5-english.zip  6.3 MB

https://www.phpmyadmin.net/downloads and extract to {LARAGON_DIR}\etc\apps\phpMyAdmin.
SHA256 hash matches
cf1adc96dcdc46360a90f10df98fefb3bfd9e5a243b52645021dc590682cffb3

Acess phpMyAdmin at: http://localhost:8083/phpmyadmin

 

 

 

 

3. Install PHP's Oracle OCI8 extension (works with both Apache & Nginx)

  1. Download OCI8 extension to access Oracle DB php_oci8-2.2.0-7.4-nts-vc15-x64.zip from https://pecl.php.net/package/oci8/2.2.0/windows . Use 'pecl install oci8' to install for PHP 7. I only unzip php_oci8_12c.dll 147456 B, 2019.12.04 in :
    J:\awww\bin\php\php-7.4.10-nts-Win32-vc15-x64\ext
    on dev site, or in
    J:\ylaragon\bin\php\php-7.4.10-nts-Win32-vc15-x64\ext on test site.
  2.  Download Oracle Instant Client instantclient-basic-windows.x64-19.8.0.0.0dbru.zip file:
    http://www.oracle.com/technetwork/topics/winx64soft-089540.html Note: You must accept "Accept License Agreement" and "create an account (Free)"
  3. Extract downloaded zip files to PHP dir (Menu > PHP > Version > dir:php-xxx-xxx)
    J:\awww\bin\php\php-7.4.10-nts-Win32-vc15-x64

  4. Enable: click Menu > PHP > Extensions > php_oci8_12c.dll

  5. Restart Apache. You should see Oracle OCI information on phpinfo().

 

Instant Client Installation for Microsoft Windows 64-bit - no need for PHP home development

See the Instant Client Home Page for more information about Instant Client packages. Client-server version interoperability is detailed in Doc ID 207303.1.

For example, Oracle Call Interface 19, 18 and 12.2 can connect to Oracle Database 11.2 or later. Some tools may have other restrictions.

  1. Download the appropriate Instant Client packages for your platform - Basic or Basic Light
  2. Unzip packages dir. eg C:\oracle\instantclient_19_3
  3. Add this dir to PATH environment variable. If you have multiple versions of Oracle libraries installed, make sure the new directory occurs first in the path. Restart any terminal windows or otherwise make sure the new PATH is used by your applications.
  4. Download and install correct Visual Studio Redistributable from Microsoft. Instant Client 19 requires the Visual Studio 2017 redistributable. Instant Client 18 and 12.2 require the Visual Studio 2013 redistributable. Instant Client 12.1 requires the Visual Studio 2010 redistributable.
  5. If you intend to co-locate optional Oracle configuration files such as tnsnames.ora, sqlnet.ora, ldap.ora, or oraaccess.xml with Instant Client, then create a subdirectory such as
    C:\oracle\instantclient_19_3\network\admin
    This is default Oracle client configuration dir for apps linked with this Instant Client.

    Alternatively, Oracle client configuration files can be put in another, accessible directory. Then set the environment variable TNS_ADMIN to that directory name.

  6. Start your application.

ODBC users should follow the ODBC Installation Instructions.

2020.01.16 To get this working with latest Laragon & PHP I had to download instant client version 12 and place DLLs in Laragon root folder (alongside laragon.exe). Placing them in php dir or Apache bin dir did not work.

 

 

4. CGI/FastCGI (FastCGI/PHP-FPM) or worse mod_php Apache module

To see which version your website is using, put a file containing <?php phpinfo(); ?> on your site and look for the Server API entry. This could say something like CGI/FastCGI or Apache 2.0 Handler - nts (Non thread safe) version is faster and/or less buggy, or otherwise they would have just offered ts (thread safe) version and not bothered to give us choice!

Preferred way to do the stack is eg FastCGI/PHP-FPM. That way you can use much faster MPM Worker. The whole PHP remains nts - non-threaded, but Apache serves threaded (like it should).

If you also look at command-line version of PHP - thread safety does not matter.

 

A ts (Thread Safe) version should be used if you want to install PHP as an Apache module where worker is the MPM. Apache MPM prefork with modphp (ts) is used because it is easy to configure/install. Performance-wise it is fairly inefficien,.so My Server API is most frequent CGI/FastCGI.

For multithreaded webservers, such as IIS5 and IIS6, you should use threaded version of PHP.

IMAP (Win/Unix) Library is not thread safe - not recommended for use in a multi-threaded environment.

 

 

Apache HTTP web server supports multiple models for handling requests, one of which called worker MPM uses threads. But it supports another concurrency model called prefork MPM - uses processes - that is, web server will create/dedicate a single process for each request.

There are multiple ways to chain the web server with PHP. For Apache HTTP Server, the most popular is "mod_php" module - actually PHP itself, but compiled as a module for web server, and so PHP gets loaded right inside web server .

Since with mod_php, PHP gets loaded right into Apache, if Apache is going to handle concurrency using its Worker MPM (that is, using Threads) then PHP must be able to operate within this same multi-threaded environment - meaning, PHP has to be thread-safe to be able to play ball correctly with Apache!

At this point, you should be thinking "OK, so if I'm using a multi-threaded web server and I'm going to embed PHP right into it, then I must use the thread-safe version of PHP". And this would be correct thinking. However, as it happens, PHP's thread-safety is highly disputed (diskutabilan). It's a use-if-you-really-really-know-what-you-are-doing ground.

Advice would be to not use PHP in a multi-threaded environment if you have the choice!

Speaking only of Unix-based environments, I'd say that fortunately, you only have to think of this if you are going to use PHP with Apache web server, in which case you are advised to go with the prefork MPM of Apache (which doesn't use threads, and therefore, PHP thread-safety doesn't matter) and all GNU/Linux distributions that I know of will take that decision for you when you are installing Apache + PHP through their package system, without even prompting you for a choice.

If you are going to use other webservers such as nginx or lighttpd, you won't have the option to embed PHP into them anyway. You will be looking at using FastCGI or something equal which works in a different model where PHP is totally outside of the server with multiple PHP processes used for answering requests through e.g. FastCGI. For such cases, thread-safety also doesn't matter.

 

5. NO NEED : How to enable a manually created virtual host

See Menu -> www -> Switch document root - any dir on PC may contain PHP, HTML... scripts which can be executed.

create a Virtual Host file without "auto." prefix, Laragon will respect any changes in the file.

Assume you have a project name: dev1 (or myproj) You can create a file name
etc/apache2/sites-enabled/dev1.conf with content like this:

<VirtualHost \*:8083> 
  DocumentRoot "J:/awww/www/"
    ServerName dev1
    ServerAlias \*.dev1.dev
    <Directory "J:/awww/www/">
       AllowOverride All
       Require all granted
    </Directory>
</VirtualHost>

Note: You need to put dev1 and dev1.dev entry to your hosts file. The quickest way is let Laragon auto-create Virtual Hosts for you (not convinient for B12phpfw ?), then you just remove the "auto." prefix from the Virtual Host file.

 

 I do not use this : apvh.bat to create AP(ache) V(irtual) H(ost) using command line in Laragon window

https://github.com/bantya/CmdVirtualHost

Change the SSL files directory on line 9 according to yours. i.e. set SSL_PATH=F:/laragon/etc/ssl/ -> set SSL_PATH=Your/Laragon/installation/path/etc/ssl/

Open the Terminal and cd into the directory where all your virtual hosts are stored. (for me: J:\ylaragon\etc\apache2\sites-enabled)

apvh {sitename} {directory} {ssl}

? Where:
sitename: Sitename containing .domain name.
directory: full absolute path to the site directory - must not contain trailing slahes (\ or /).
ssl: Use ssl to have the virtual host for SSL else empty.

?? Remember:
This script assumes that you have added virtual host entry to
C:\Windows\System32\drivers\etc\hosts
file and in alt_names section in the openssl template file (for me: in J:\ylaragon\bin\laragon\tpl\openssl.conf.tpl, not in J:\ylaragon\usr\tpl\openssl.conf.tpl)

?? Acronyms:
apvh === Apache virtual host.
India == Indians never delay in anything.

@echo off

:: Author https://github.com/bantya
:: Manually create apache virtual hosts file for Laragon

set SITE\_NAME=%1
set SITE\_PATH=%2
set WANT\_SSL=%3
set SSL\_PATH=F:/laragon/etc/ssl/

if "%SITE\_PATH:~-1,1%" neq "/" (
set SITE\_PATH=%SITE\_PATH:\\=/%/
)

if "%WANT\_SSL%" == "" (
echo.
(
echo.^<VirtualHost \*:80^>
echo. DocumentRoot "%SITE\_PATH%"
echo. ServerName %SITE\_NAME%
echo. ServerAlias \*.%SITE\_NAME%
echo. ^<Directory "%SITE\_PATH%"^>
echo. AllowOverride All
echo. Require all granted
echo. ^</Directory^>
echo.^</VirtualHost^>
) ^> %SITE\_NAME%.conf
)

if "%WANT\_SSL%" == "ssl" (
echo.
(
echo.define ROOT "%SITE\_PATH%"
echo.define SITE "%SITE\_NAME%"
echo.
echo.^<VirtualHost \*:80^>
echo. DocumentRoot "${ROOT}"
echo. ServerName ${SITE}
echo. ServerAlias \*.${SITE}
echo. ^<Directory "${ROOT}"^>
echo. AllowOverride All
echo. Require all granted
echo. ^</Directory^>
echo.^</VirtualHost^>
echo.
echo.^<VirtualHost \*:443^>
echo. DocumentRoot "${ROOT}"
echo. ServerName ${SITE}
echo. ServerAlias \*.${SITE}
echo. ^<Directory "${ROOT}"^>
echo. AllowOverride All
echo. Require all granted
echo. ^</Directory^>
echo.
echo. SSLEngine on
echo. SSLCertificateFile %SSL\_PATH%%SITE\_NAME%.crt
echo. SSLCertificateKeyFile %SSL\_PATH%%SITE\_NAME%.key
echo.^</VirtualHost^>
) ^> %SITE\_NAME%.conf
)

echo.Your Apache virtual-host file %SITE\_NAME%.conf is created.
pause
start .

nts and nsp>

 

 

MS Expression web WYSIWYG HTML editor

<body style="margin: 1em; padding: 30px 10% 50px 10%; 
font-size: 1.2em; font-family: Corbel, Arial, Helvetica, sans-serif ;
">

 


C:\WINDOWS\system32>path
displays PATH= ...

 

 

 PHP's interactive console

https://www.sitepoint.com/interactive-php-debugging-psysh/

php -a
Interactive shell

php > $a = 'Hello world!';
php > echo $a;
Hello world!
php >

Interactive shell is not a REPL (Read-Eval-Print Loop) since it lacks the print - seen $a immediately after assigning it.

http://psysh.org/manual/en/php_manual.sqlite for Psysh see https://github.com/bobthecow/psysh/wiki/PHP-manual

 

 
composer require psy/psysh:@stable
on Windows J:\awww\www>.\vendor\bin\psysh        on Linux ./vendor/bin/psysh
                    or : 
                    git clone https://github.com/bobthecow/psysh.git
                    cd psysh
                    composer install
                    ./bin/psysh
                    or:
                    wget https://psysh.org/psysh
                    chmod +x psysh
                    ./psysh

 

 

Getting Started

https://laragon.org/docs/index.html

https://forum.laragon.org/category/5/tutorials - Add newer PHP... XDebug, PostgreSQL, Python, ruby, Rails, Golang

Also https://github.com/denoland/deno/ - provide a productive and secure scripting environment for modern programmer. It is built on top of V8, Rust, and TypeScript.

https://www.webtng.com/best-wamp-server-for-local-wordpress-laragon-is-easy/

https://getwebassist.com/laragon-local-development/

https://github.com/leokhoa/laragon - download or   https://laragon.org/download/

 

https://forum.laragon.org/topic/877/tutorial-how-to-install-magento-with-laragon

https://forum.laragon.org/topic/241/tutorial-how-to-add-your-favourite-editor-to-laragon-and-the-windows-right-click-menu

https://forum.laragon.org/topic/1073/tutorial-how-to-auto-change-apache-version-after-changing-php-version

https://forum.laragon.org/topic/1384/how-i-can-acces-to-phpmyadmin-from-other-pc-in-my-local-red

https://forum.laragon.org/topic/1306/access-denied-how-to-manage-quick-apps

https://forum.laragon.org/topic/1117/tutorial-using-global-php-ini

[https://forum.laragon.org/topic/817/how-to-access-the-localhost-in-remote-computer-through-lan-network]
(https://forum.laragon.org/topic/817/how-to-access-the-localhost-in-remote-computer-through-lan-network)