Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Drupal 7, PHP 5.4 and MySQL via Software Collections

August 6, 2013
Langdon White
Related topics:
Linux
Related products:
Red Hat Enterprise Linux

Share:

    In order to test out the new Red Hat Software Collections (RHSCL, announcement) version of PHP 5.4, I decided to build out a Drupal 7 install using the php54 collection and the mysql55 collection.

    Overall, the activity was pretty much like a normal Drupal install. However, to use software collections you have to do a few things differently. Also, if you haven't used a software collection for a "service" (e.g. MySQL) before, the service setup is also a little different than the native versions.

    First and foremost, add the channels for RHSCL either via subscription manager or rhn. The name of the channel (for the beta) is rhel-server-rhscl-6-beta-rpms. After that, you need to install the software collections. So, something like:

    #yum install php54 mysql55

    You could also just install all the dependencies in the same line, but I wanted to pull them out to be able to comment on them a little bit more. I also tend to install some of the semi-optional components because I think Drupal works better that way.

    First off, the easiest thing to install, which is also not really related to software collections, is gd (not called "GIF Draw" :) ). Very simple, just install gd from the normal RHEL repositories.

    #yum install gd

    Next, we need the "driver" libraries for php to various other things. All the ones we need are included in the "php54 Software Collection" but are not installed by the simple install of the php54 package as they are not required for basic php. php54-php-gd is the connection from php to the gd library. php54-php-mbstring is a library for unicode, technically not a "driver" but an optional library. Finally, we need to connect to mysql so we install php54-php-mysqlnd.

    #yum install php54-php-gd php54-php-mbstring php54-php-mysqlnd

    Last but not least, we need to install the php "driver" for httpd. Now, I call this one out

    because I always hear this referred to as mod_php. Well, the interesting thing is, in RHEL mod_php is just a shorthand for the name of the real library (in the software collection, libphp54-php5.so). As a result, you need to install php54-php (which you can also install by using the name php_mod) which includes the correct httpd module to support php.

    #yum install php54-php

    Now for all of you that want to just have one line to install:

    #yum install httpd php54 mysql55 gd php54-php-gd php54-php-mbstring php54-php-mysqlnd php54-php

    OK, moving on to making things run. First, you need to make mysql55 start. Pretty straightforward, you just do it normally but put in the "correct" name for MySQL.

    #chkconfig mysql55 on
    #service mysql55 start

    You also need to make sure that the apache webserver is running but this is no different than you would without software collections.

    #chkconfig httpd on
    #service httpd start

    Now, let's create the database. Mind you, I am really trying to show how to set this up for development with these new software collections, not a proper, hardened production box. You can follow similar steps for production, but you should be doing things like locking down access to the database in MySQL, potentially splitting the web server from the database server, etc.

    #scl enable mysql55 mysql
    (do the above as root for autologin)

    Then:

    mysql>CREATE DATABASE drupalDev;
    mysql>CREATE USER 'drupal'@'localhost' IDENTIFIED BY 'drupal';
    mysql>GRANT USAGE ON *.* TO 'drupal'@'localhost';
    mysql>GRANT ALL ON drupalDev.* TO 'drupal'@'localhost;

    OK, now we can begin the Drupal install. Download the latest tarball of Drupal from drupal.org. Extract it, and put it where you prefer. During development, I usually install it under a "projects" directory under my user account. I also, usually, add the apache group to my user, then give the appropriate permissions to the group on my directories to allow the webserver to access the files.

    $ mkdir -p /home/my-user/projects/my-drupal-proj/
    $ cd /home/my-user/projects/my-drupal-proj/
    $ mv ~/Downloads/drupal-7.22.tar.gz /home/my-user/projects/my-drupal-proj/
    $ tar -xf drupal-7.22.tar.gz
    # usermod -a -G apache my-user (note: root perms)
    $ chown -R my-user:apache /home/my-user/projects/my-drupal-proj/
    $ chmod -R g+w /home/my-user/projects/my-drupal-proj/drupal-7.22/

    I also usually set up a VirtualHost so that I can easily get to the site and not introduce potential issues because of a difference in subdirectories between dev and prod. Given the above setup, I would use the following VirtualHost conf file. Don't forget to add my-drupal-proj as a host in /etc/hosts (e.g. 127.0.0.1 my-drupal-proj).

    <VirtualHost *:80>
            ServerName my-drupal-proj
            ServerAdmin me-user@myemail.com
            DocumentRoot /home/my-user/projects/my-drupal-proj/drupal-7.22
            <Directory /home/my-user/projects/my-drupal-proj/drupal-7.22>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
            </Directory>
            ErrorLog /home/my-user/projects/my-drupal-proj/logs/error.log
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel info
            CustomLog /home/my-user/projects/my-drupal-proj/logs/access.log combined
    </VirtualHost>

    Finally, we can just follow the normal, web-based, install process by starting approximately here in the Drupal Installation Guide by going to http://my-drupal-proj/

    Last updated: November 2, 2023

    Recent Posts

    • Alternatives to creating bootc images from scratch

    • How to update OpenStack Services on OpenShift

    • How to integrate vLLM inference into your macOS and iOS apps

    • How Insights events enhance system life cycle management

    • Meet the Red Hat Node.js team at PowerUP 2025

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue