Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Drupal 7, PHP 5.4 and MySQL via Software Collections

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

    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

    • Federated identity across the hybrid cloud using zero trust workload identity manager

    • Confidential virtual machine storage attack scenarios

    • Introducing virtualization platform autopilot

    • Integrate zero trust workload identity manager with Red Hat OpenShift GitOps

    • Best Practice Configuration and Tuning for Linux and Windows VMs

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    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
    © 2026 Red Hat

    Red Hat legal and privacy links

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

    Chat Support

    Please log in with your Red Hat account to access chat support.