If you don’t have XAMPP, please install it first according to “Installation of XAMPP“. And If you’ll use MariaDB in a production environment, make it secure by setting password according to “How To Set MySQL Password in XAMPP“.
Method
1. Open phpMyAdmin
Start XAMPP Control Panel and run Apache and MariaDB.
Access localhost/phpmyadmin/ or click Admin button of MySQL.
If you don’t have XAMPP, please install it first according to “Installation of XAMPP“.
XAMPP security
Please refer to “Is XAMPP production ready?” in Windows Frequently Asked Questions for information. Though it contains some old contents, but it says why default XAMPP shouldn’t be used in a production environment.
Method
1. Run Apache and MySQL
Start XAMPP Control Panel and run Apache and MySQL.
2. Access phpMyAdmin and change password
Access localhost/phpmyadmin with your browser. And click “User accounts”.
Click “Edit privileges” for root@localhost.
Click “Change password”.
Input your password. You can generate highly safe password with Generate button. And click “Go” button.
Close phpMyAdmin.
*An error will occur when accessing phpMyAdmin now because phpMyAdmin doesn’t know the password.
3. Change config.inc.php of phpMyAdmin
Open xampp\phpMyAdmin\config.inc.php and change the value of $cfg[‘Servers’][$i][‘password’].
/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = ''; //input the password here
Save the file and close it.
Confirmation
Open the shell.
And input command “mysql -h localhost -u root -p” and the password you defined.
# mysql -h localhost -u root -p
Enter password: <input password here>
Confirm that MariaDB is connected.
Input “quit” to quit MySQL.
And confirm that you can access localhost/phpmyadmin.
I installed XAMPP in Installation of XAMPP. Today, I’ll use XAMPP as a test environment for PHP.
GOAL
To setup XAMPP and start PHP development in XAMPP.
How to start XAMPP
Be sure that the started module is stopped before quitting the control panel.
Method 1 Use xampp/xampp-control.exe
Right-click and run as administrator “xampp/xampp-control.exe” or “XAMPP Control Panel” in start menu.
Click “Start” buttons on the control panel.
If you add modules as a service, the check box is checked. *You can’t see whether the check box is checked if you run the control panel as a non-administrator.
In this article below, a situation in which all modules are not registered as a service is supposed.
Click “Start” to start Apache and access localhost to confirm that apache is running.
Open browser and input “localhost”The index page of XAMPP
Method 2 Use batch file
Use batch files in xampp\ directory to start each application individually.
xampp\xampp_start.exe xampp\xampp_stop.exe xampp\apache_start.bat xampp\apache_stop.bat mysql_start.bat, mercury_start.bat and filezilla_start.bat
Run your php program
The directory “xampp\htdocs” is document root that is assigned to localhost. So you can run your php program by putting the php file here.
Open xampp\htdocs\index.php and you can see the program to redirect users to localhost/dashboard by using header() function.
PID, the process ID, is a number used in some operating system kernels to identify processes uniquely.
Methods
Method 1
Open “Task Manager” and open “Details” tab. See the PID of each Process.
Method 2
Use tasklist command and you can get the list of currently running tasks.
>tasklist
Image Name PID Session Name Session# Mem Usage
============ ===== ============= ========= =========
System Idle 0 Services 0 8 K
System 4 Services 0 2,728 K
Registry 120 Services 0 36,960 K
...
To understand the Windows service and how to register an application as a service.
What is Windows service?
Microsoft Windows services, formerly known as NT services, enable you to create long-running executable applications that run in their own Windows sessions.
These features make services ideal for use on a server or whenever you need long-running functionality that does not interfere with other users who are working on the same computer.
You can see Windows service applications registered in your PC. Right-click “Start” and click “Computer Management.”
Open Services and you can see the list of Windows service application.
Windows service application contains updater, time setter and security software because these need to be executed automatically. And these applications should be executed without user login and user authority.
Status: Running or not
Srartup Type: Manual, Manual (Trigger Start), Automatic, Automatic (Trigger Start), Automatic (Delayed Start) and so on.
Features of Windows Service
It can be started automatically
It works in background
It works without user interface
It can work with any user
What is SCM?
SCM, Service Control Manager is a service for controlling services, which starts, stops, and monitors the status of services. SCM is started by the Winlogon process (winlogon.exe) when Windows starts and starts processes which have “Automatic” startup type.
SCM database
SCM has “SCM database” that is a database of registered services. You can see the SCM database with Register Editor. Press Windows key + R and run “regedit”.
Then you can find the registry “Services” in your computer.
How SCM starts and stops services
How to start
1. SCM starts the service process
2. StartServiceCtrlDispatcher that is the function to connect service to SCM is called in the service process
Then the calling thread, the main thread, is connected to the SCM and the control won’t returned until a services runnning in the process have terminated.
3. The main thread call RegisterServiceCtrlHandlerEx function to handle extended service control requests and create the service thread to execute ServiceMain() function.
4. The service thread starts ServiceMain function when accepting the control request. ServiceMain function is the main function of each service program.
5. The status of the started service is changed to “Running”.
How to end
1. SCM send stop request to the main thread.
2. The main thread stop the service thread and the service thread is removed.
3. The status of the stopped service is changed to “Stopped”.
4. StartServiceCtrlDispatcher is returned.
How to install the service application
Use command below to install with installUtil.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installUtil.exe <Path to the application>
Use command below to uninstall.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installUtil.exe /u <Path to the application>
You can use sc command too to install the service.
sc create SVC1 binPath= <Path to the application> DisplayName= "" description= "" start= auto
Sc command is used to check the status of services, create, delete, and manage them.
What is the difference between installUtil and sc?
When I quit XAMPP, an error “Control Panel, an Error: Cannot create file “…\xampp\xampp-control.ini” occured.
And the message “Application Error (Not Responding)” displayed.
Environment
Windows10 XAMPP 7.4.10
What is xampp-control.ini?
If you’d like to know what XAMPP is, please refer the article “Installation of XAMPP“. xampp-control.ini is the configuration settings of XAMPP. It contains variables and values as below.
Today’s goal is to understand what XAMPP is and how to install it. This article doesn’t contain how to use XAMPP or PHP.
Environment
Windows10 XAMPP 7.4.10
What is XAMPP?
XAMPP is a free development environment for PHP. It contains the set of basic free software for web development, such as Apache, MariaDB as a SQL server, PHP, Perl, phpMyAdmin and OpenSSL.
You can see what software is included in XAMPP in the official site.
XAMPP is an acronym for cross platform(X), Apache, MariaDB, PHP and Perl.
How to Install XAMPP
1. Download
Access “Download” page in the official site. And download any version of XAMPP you like.