• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Sunday, June 15, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to Install PHP on Oracle Linux

in Linux OS, Oracle Linux, Red Hat Enterprise Linux
How to Install PHP on Oracle Linux

In this blog post, we will walk you through the process of how to install PHP on Oracle Linux. PHP is a widely-used open-source scripting language, especially suited for web development. It can be embedded into HTML, making it a popular choice for server-side scripting.

Table of Contents

  • Prerequisites
  • Installing PHP
  • Testing PHP
  • Configuring PHP
  • Conclusion

How to Install PHP on Oracle Linux

Prerequisites

Before we begin, ensure that you have the following installed on your Oracle Linux system:

  1. Oracle Linux (version 7 or 8) installed and updated
  2. A web server, either Apache or Nginx
  3. MariaDB or MySQL database server (optional, but recommended)

Installing PHP on Oracle Linux

First, let’s update the system and install the necessary dependencies:

sudo yum update
sudo yum install -y epel-release yum-utils

Next, enable the appropriate PHP repository. For Oracle Linux 7, use the Remi repository:

sudo yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum-config-manager --enable remi-php74

For Oracle Linux 8, use the AppStream repository:

sudo dnf module reset php
sudo dnf module enable php:remi-7.4

Now, we are ready to install PHP. For Apache users, run:

sudo yum install -y php

For Nginx users, install PHP-FPM (FastCGI Process Manager) as well:

sudo yum install -y php php-fpm

After installation, start and enable the PHP-FPM service:

sudo systemctl start php-fpm
sudo systemctl enable php-fpm

Testing PHP

To test the PHP installation, create a simple PHP script. Use your favorite text editor (e.g., Vim, Nano) to create a new file named info.php in your web server’s document root. For Apache users, this is usually /var/www/html. For Nginx users, this is typically /usr/share/nginx/html.

Paste the following code into the info.php file:

<?php
phpinfo();
?>

Save the file and exit the editor. Now, open your web browser and visit http://your_server_ip/info.php. You should see a page displaying information about your PHP installation.

Configuring PHP on Oracle Linux

To configure PHP, edit the php.ini file. This file is located in the /etc directory.

For Apache users:

sudo nano /etc/php.ini

For Nginx users:

sudo nano /etc/php-fpm.d/www.conf

Inside the configuration file, you can customize various settings, such as memory limits, file upload sizes, and error reporting. Make sure to restart your web server and PHP-FPM (for Nginx users) after making any changes:

sudo systemctl restart httpd  # For Apache users
sudo systemctl restart nginx  # For Nginx users
sudo systemctl restart php-fpm  # For Nginx users with PHP-FPM

Additional PHP Extensions

To enhance the functionality of your PHP installation, you may want to install additional PHP extensions. Some common extensions include:

  • php-mysql for MySQL/MariaDB database support
  • php-gd for image manipulation
  • php-mbstring for multi-byte string handling
  • php-xml for XML parsing and manipulation

To install these extensions, use the following commands:

sudo yum install -y php-mysql php-gd php-mbstring php-xml

After installing the extensions, restart your web server and PHP-FPM service (for Nginx users) to load the new extensions:

sudo systemctl restart httpd  # For Apache users
sudo systemctl restart nginx  # For Nginx users
sudo systemctl restart php-fpm  # For Nginx users with PHP-FPM

Securing PHP

To improve the security of your PHP installation, consider making the following changes in your php.ini file:

  1. Disable allow_url_fopen and allow_url_include to prevent remote file inclusion vulnerabilities:makefile
allow_url_fopen = Off
allow_url_include = Off

Set a proper timezone:

date.timezone = "Your/Timezone"

Replace “Your/Timezone” with your actual timezone. You can find a list of supported timezones here.

Limit the post_max_size and upload_max_filesize settings to reasonable values:

post_max_size = 8M
upload_max_filesize = 2M

Disable dangerous PHP functions:

disable_functions = "exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source"

After making these changes, don’t forget to restart your web server and PHP-FPM service (for Nginx users).

Conclusion

You have successfully installed PHP on your Oracle Linux system. With PHP, you can now create dynamic web applications or use popular content management systems like WordPress. Make sure to explore other essential tools and services for your web server, such as installing CSF on your Linux server or setting up an OpenVPN server for secure remote access.

ShareTweet
Previous Post

How to Install Unzip on Oracle Linux

Next Post

How to Install phpMyAdmin on Oracle Linux

Related Posts

How to Install Flask on Rocky Linux

How to Install Flask on Rocky Linux

How to Install Tomcat on Rocky Linux

How to Install Apache Tomcat on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Set up NTP Server on Rocky Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.