AITB International Conference, 2019
Kathmandu, Nepal
My Youtube Channel
Please Subscribe
Flag of Nepal
Built in OpenGL
World Covid-19 Data Visualization
Choropleth map
Word Cloud in Python
With masked image
Sunday, November 9, 2025
Thursday, February 1, 2024
Steps to install HTTPD, PHP, MYSQL and PHPMYADMIN in CentOS 8
Steps to install httpd in CentOS 8
- sudo yum install dnf
- sudo dnf update
- sudo dnf install httpd
- sudo systemctl start httpd
- sudo systemctl enablr httpd
- sudo systemctl enable httpd
- sudo firewall-cmd --add-service=http --permanent
- sudo firewall-cmd --reload
- sudo systemctl status httpd
- sudo dnf update
- sudo dnf update
- sudo dnf install epel-release
- sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
- sudo dnf module enable php:remi-8.2
- sudo dnf module reset php
- sudo dnf module enable php:remi-8.2
- sudo dnf module list php
- sudo dnf install php php-cli php-fpm php-mysqlnd php-pdo php-gd php-xml
- php -v
- sudo dnf update
- sudo dnf install https://dev.mysql.com/get/mysql80-community-release-el8- 3.noarch.rpm
- sudo dnf module enable mysql:8.0
- sudo dnf update
- sudo dnf install mysql-server
- sudo systemctl start php-fpm
- sudo systemctl enable php-fpm
- sudo systemctl restart httpd
- sudo systemctl start mysqld
- sudo systemctl enable mysqld
- Sudo dnf install epel-release
- sudo dnf update
- yum -y update
- yum -y install phpmyadmin
- dnf --enablerepo=remi install phpMyAdmin
- sudo vi /etc/httpd/conf.d/phpMyAdmin.conf
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset
UTF-8
<IfModule
mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require all
granted
</RequireAny>
</IfModule>
<IfModule
!mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from
127.0.0.1
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
7. sudo systemctl restart httpd
8. You can verify the phpmyadmin installation by opening URL:
http://your_server_ip/phpMyAdmin
Alternative way to install phpmyadmin on CentOS 8
- sudo dnf update
- sudo dnf install tar
- sudo dnf install wget
- wget https://files.phpmyadmin.net/phpMyAdmin/5.1.3/phpMyAdmin-5.1.3-all-languages.tar.gz
- tar xzf phpMyAdmin-5.1.3-all-languages.tar.gz
- sudo mv phpMyAdmin-5.1.3-all-languages /usr/share/phpMyAdmin
- sudo mkdir /etc/phpMyAdmin
- sudo cp /usr/share/phpMyAdmin/config.sample.inc.php /etc/phpMyAdmin/config.inc.php
- sudo chmod 660 /etc/phpMyAdmin/config.inc.php
- sudo chown -R apache:apache /etc/phpMyAdmin
- sudo vi /etc/phpMyAdmin/config.inc.php
- add to config.inc.php,
13. sudo vi /etc/httpd/conf.d/phpMyAdmin.conf
Your phpMyAdmin.conf should be similar to given below,
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
Note: "vi" command used above is an editor. I hope you know how to use it.
To insert, press i
To exit without saving, press esc then :q! and then enter
To exit along with saving, press esc then :wq! then enter
Saturday, August 5, 2023
Will "mysqli" extension work for MariaDB database?
Yes, `mysqli` can work with MariaDB in PHP. The `mysqli` extension stands for "MySQL Improved" and is designed to work with both MySQL and MariaDB databases. MariaDB is a fork of MySQL, so they share a lot of similarities and are largely compatible with each other.
When you use the `mysqli` extension in PHP, you can connect to both MySQL and MariaDB databases using the same functions and methods. This is because the `mysqli` extension provides an improved and more feature-rich API for accessing MySQL and MariaDB databases in PHP.
Here's a simple example of connecting to a MariaDB database using `mysqli` in PHP:
<?php
$servername = "localhost";
$username = "your_username";
$password = "your_password";
$dbname = "your_database";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
// Close connection
$conn->close();
?>
Remember to replace `your_username`, `your_password`, and `your_database` with your actual database credentials.
So, whether you are working with MySQL or MariaDB, you can use `mysqli` in PHP to interact with the database effectively.
Install Apache, PHP on Centos 8
Apache installation on centos
8
To install
Apache on CentOS 8, you can use the `dnf` package manager, which is the
replacement for `yum` in CentOS 8. Here's a step-by-step guide to installing
Apache:
1. Open a
terminal on your CentOS 8 system.
2. Update
the package list to ensure you have the latest information about available
packages:
sudo dnf update
3.
Install Apache using the `dnf` package manager:
sudo dnf install
httpd
4. After
the installation is complete, start the Apache service:
sudo systemctl start
httpd
5. Enable
Apache to start on boot:
sudo systemctl
enable httpd
6. Check
the status of Apache to ensure it's running without any issues:
sudo systemctl
status httpd
7. Adjust
the firewall settings to allow incoming HTTP traffic:
sudo firewall-cmd
--add-service=http --permanent
sudo firewall-cmd
--reload
Now, Apache should be
installed and running on your CentOS 8 system. You can verify its functionality
by opening a web browser and accessing your server's IP address or domain name.
You should see the default Apache welcome page if everything is set up
correctly.
PHP installation on centos 8
To install PHP on CentOS
8, you can use the `dnf` package manager. Additionally, you may want to install
some commonly used PHP extensions to ensure the proper functioning of PHP-based
applications. Here's a step-by-step guide to installing PHP:
1. Open a
terminal on your CentOS 8 system.
2. Update
the package list to ensure you have the latest information about available
packages:
sudo dnf update
3.
Install PHP and some commonly used extensions:
sudo dnf install php
php-cli php-fpm php-mysqlnd php-pdo php-gd php-xml php-mbstring
The packages above include
the basic PHP package (`php`), command-line interface (`php-cli`), PHP-FPM
(FastCGI Process Manager) for serving PHP through a web server, MySQL support
(`php-mysqlnd`), PDO (PHP Data Objects) for database connectivity (`php-pdo`),
GD library for image manipulation (`php-gd`), XML support (`php-xml`), and
multibyte string support (`php-mbstring`).
4. After
the installation is complete, start and enable the PHP-FPM service:
sudo systemctl start
php-fpm
sudo systemctl
enable php-fpm
5. Check
the status of PHP-FPM to ensure it's running without any issues:
sudo systemctl
status php-fpm
6. Restart
Apache: After making any changes to the Apache or PHP-FPM configuration,
restart Apache to apply the changes:
sudo systemctl
restart httpd
Now, PHP is installed and
ready to be used on your CentOS 8 system. You can test your PHP installation by
creating a PHP file with the following content:
<?php
phpinfo();
?>
Save the file as
`info.php` in your web server's document root directory (typically
`/var/www/html/`):
sudo echo
"<?php phpinfo(); ?>" > /var/www/html/info.php
Then, open a web browser
and navigate to `http://your_server_ip/info.php` or
`http://your_domain/info.php`. You should see a PHP information page displaying
PHP version, configuration settings, and more. Remember to remove this
`info.php` file after testing for security reasons.









