If you are running an Apache web server on your Linux system and find that PHP files are not being executed, there are a few potential solutions that can help with this problem. PHP is a common component of web server setups, and is the programming langauge used by WordPress, the most popular content management system in the world. It is commonly installed alongside Apache and MySQL, which is known as LAMP (Linux, Apache, MySQL, PHP).
php
How to install PHP on Ubuntu Linux
PHP is one of the most used languages when it comes to programming dynamic web sites. If you are a web developer, or just hosting a website that requires PHP, you will need to install the software on your server in order for your website to make use of its PHP code.
Ubuntu 22.04 LAMP installation
A LAMP stack is an assortment of software that contains everything you need in order to serve a website, show dynamic content, and store or retrieve data from a database. The software is all within the LAMP acronym, namely the Linux operating system, Apache web server, MySQL database (or MariaDB alternatively), and PHP programming language.
How to install XAMPP on Ubuntu Linux
Hosting a website on a Linux system usually involves multiple software packages that operate together to deliver a web browsing experience to potential viewers. For example, it’s common for PHP to dynamically render web content but retrieve data from a database. These are two separate components and they must both be installed to present a website as intended.
XAMPP is a software stack that can run on Ubuntu Linux and make your life a little easier when it comes to web hosting. XAMPP stands for cross-platform (X), Apache (A), MariaDB (M), PHP (P), and Perl (P). These are all common components used in web hosting, and combining them into a single installation makes the initial setup less complicated. XAMPP also comes with Bitnami, which allows you to install content managements systems, such as WordPress, as well as other apps on top of your XAMPP installation if you choose.
In this guide, we’ll cover the installation of XAMPP on Ubuntu Linux. Follow along with our step by step instructions to get it setup on your own system.
In this tutorial you will learn:
- How to install XAMPP on Ubuntu Linux
- How to manage your XAMPP installation
How to check PHP version on Ubuntu
After installing PHP or an entire LAMP server on Ubuntu Linux, there are a few ways you can check to see what version you’re running at any time. This can help you stay up to date and develop web applications that adhere to newer coding standards and conventions, since PHP is still being developed.
In this guide, we’ll show you multiple ways to check the version of PHP on Ubuntu. Feel free to pick whichever method is most convenient for your situation.
In this tutorial you will learn:
- How to check PHP version on Ubuntu
How to create phpinfo.php page
PHP developers and web server admins can use the phpinfo function to quickly see information about their installation of PHP. This can assist in debugging, seeing what version of PHP is installed, or seeing various configuration options.
On Linux systems, it’s common to make a phpinfo.php page after installing a LAMP server or LEMP server to make sure that PHP is working and to verify settings.
In this tutorial, we’ll guide you through the creation of a phpinfo.php page on your own system, as well as how to access this file afterwards.
In this tutorial you will learn:
- How to create phpinfo.php page
Installation of missing php-mbstring on RHEL 7 Linux
The php-mbstring
is part of Redhat’s server optional packages. If you have a current subscirption all you need to do is to enable this repository using:
[root@rhel7 ~]# subscription-manager repos --enable=rhel-7-server-optional-rpms
and use yum to install php-mbstring
. In case that you do not have a current Redhat subscription you can install php-mbstring
directly from IUS project repository:
[root@rhel7 ~]# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/7/x86_64/ius-release-1.0-13.ius.el7.noarch.rpm [root@rhel7 ~]# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm [root@rhel7 ~]# rpm -Uvh *release*.rpm
How to perform web requests with PHP using the cURL extension
The open source libcurl
is client-side URL
transfer library which supports a lot of protocols like FTP
, HTTP
, HTTPS
and works on a multitude of platforms. The PHP cURL
module let us access the functionalities provided by the library from the PHP programming language. In this tutorial we will see how to install the module and how to use it to perform simple requests.
In this tutorial you will learn:
- How to install the cURL module
- The basic steps to follow to initialiaze a cURL session and perform a request
- How to perform a GET request with PHP cURL
- How to perform a POST request with PHP cURL
How to setup the Nginx web server on Ubuntu 18.04 Bionic Beaver Linux
Objective
Learn how to install and configure the Nginx web server on Ubuntu 18.04 Bionic Beaver
Requirements
- Root permissions
Conventions
- # – requires given linux commands to be executed with root privileges either
directly as a root user or by use ofsudo
command - $ – requires given linux commands to be executed as a regular non-privileged user
Other Versions of this Tutorial
Introduction
The Nginx web server, together with Apache, is one of the most known and used web servers in the world. It is generally less resource-hungry than Apache, and can be also used as a reverse-proxy.
In this tutorial we will see how to install and configure the Nginx web server on Ubuntu 18.04 Bionic Beaver.
Location of php.ini on Ubuntu 20.04 Focal Fossa Linux
The objective of this guide is to learn how to find location of the loaded php.ini
. file.
In this tutorial you will learn:
- How to find location of php.ini from command line
- How to find location of php.ini by using the
phpinfo()
function
How to enable sessions in PHP with cookies
Cookies are all around in our everyday life while we browse the Internet. Most people wouldn’t know much about them, if not for those “our website uses cookies to be operational” signs that are on mostly any page now since GDPR. Cookies have a long history if sometimes being good, sometimes bad. As it is usual with most aspects of the world, this technology can be used in a good or bad way.
In this tutorial we will explore cookies a bit from the server side programming perspective: we’ll create an example cookie in PHP, and store the visitor’s chosen username in it. The cookie will reside in the browser of the visitor, so on the next visit we can read it and use it to greet the visitor on the username submitted.
Our simple webpage will recognize the visitor as long as the cookie is present in the browser. We do not store any information on the server side: if the visitor first checks in from a PC, and next time from a smartphone, we will not know it is the same individual. This is one of the main point with cookies: we can only identify the given client, and only as long as the data is provided by that particular browser.
In this tutorial you will learn:
- How to setup the test environment
- How to write a simple example program that uses cookies
- How to test the workings of the program
- How to reset the environment
Install And Host Laravel On Ubuntu 18.04 Bionic Beaver Linux
Objective
Install Laravel with Nginx and MariaDB on Ubuntu 18.04
Distributions
Ubuntu 18.04 Bionic Beaver
Requirements
A working install of Ubuntu 18.04 with root privileges
Difficulty
Easy
Conventions
- # – requires given linux commands to be executed with root privileges either directly as a root user or by use of
sudo
command - $ – requires given linux commands to be executed as a regular non-privileged user
Introduction
Laravel as quickly earned its place as the top PHP framework. It brought a lot of developer friendly features found in other frameworks like Rails to the PHP ecosystem, and in doing so, modernized PHP development.
If you’re looking to develop with Laravel or host it on Ubuntu 18.04, the setup process has never been easier. Since Laravel is PHP, there are a couple of ways to handle this, but Nginx and MariaDB provide a fairly straightforward way to get your project running with modern production-ready tools.