PHP Shell Scripting for Linux/Unix Administrators

Learn how to use PHP for powerful shell scripting, and web based reporting.
0.0 (0 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
34 students enrolled
Take This Course
  • Lectures 41
  • Length 2 hours
  • Skill Level All Levels
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 11/2015 English

Course Description

Hello, and thank you for you interest in this course. I have been programming PHP since 2000. I have also been a Linux/Unix Administrator since 2000. I have worked with PHP in Shell script applications and Web-Based applications since 2000 as well.

I have written many tools, and managed over 600 servers, and built Linux environments from 2 servers to over 200, in less than 2 years. I have a lot of industry experience, and now I want to share this knowledge with you, so that it can help your career.

In my early days, I was in-between C and Java, and I choose C, and even C over C++, because I was more interested in the systems language that Linux was written in. I grew found of PHP mostly due to its C-like syntax. In fact it is like C, but much easier to pick up. There are no type declarations, or linking, or compiling. It is very easy to go from C to PHP, since most of the functions and operators work the same.

However PHP is even better, since you can write it inline with Web-Based HTML. It makes sys admin work, and web-based reports, only needing to know one language to do both jobs.

With the helper functions that I show you in the course, you will learn how easy it is to turn command line tools, into objects PHP can easily harness. With this you will be able to write scripts fast and quick.

My largest installation of PHP grown scripts, was at a company, where I scripted so much through PHP, that it would have taken 3 full-time people to replace what I had written.

Never fear running out of work, I was always busy at that job, and I never ran out of work, that is why I had scripted so much, just to get ahead and stay afloat. PHP is a powerful language. You can hardness data, and send it right into a database, in fact PHP libraries work with just about every database on the market, making it great glue code to import and export between different platforms.

Enroll now, and let's get started putting PHP to work for you, and letting it enhance and move your career forward.

What are the requirements?

  • Have access to a terminal or command line prompt.
  • Prior shell scripting is helpful, or knowledge of the command line is helpful.

What am I going to get from this course?

  • Learn PHP Shell Scripting
  • Learn by Example
  • Learn by Examining Code
  • Learn by Real-Use case
  • Learn to write PHP Shell Scripts, and Web-based tools.

Who is the target audience?

  • Unix/Linux Administrators wanting more powerful scripts than Bash/Korn
  • PHP Coders looking to automate tasks in Unix/Linux
  • If you have written PHP code, I will show you how to modify it for the command line.
  • This is not a web development course.

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Course Introduction

Introduction to PHP Shell Scripting for Linux/Unix Administrators. This course covers helping Unix/Linux Administrators learn about PHP shell scripts. You will learn how to code, and how to convert shell scripts to PHP, and how to use PHP for Web-Based applications.

Section 2: Intro to PHP Scripting

This section is a brief overview of PHP, and some system related aspects of PHP, that are helpful to know.


PHP is an interpreted language, here are some things to understand about PHP, as opposed to or like PERL.


The unique advantage of PHP, is that you can easily run it over the command line, or through mod_php in apache. Php is also adapt to database connections, with a modern library of current database support.


INI Files are the basis for global PHP configuration, here is where to find them on the system.


The most common values that need to be changed in a PHP INI file are listed in this lesson.

3 questions

Intro to PHP Quiz

Introduction File Zips
Section 3: PHP By Example

In this section we look at a working script, which compares the contents of two files, they are actually database table dumps, and the script goes and determines which tables are missing from the other file.


First we start with a script, that is written, and explore what it does.


Looking at the files we are searching for, we begin to further understand what the script is doing, and learn about refined parsing methods.


Looking further still we examine and explore the rest of the file, and make deductions about what we might want to change later on.


Now that we understand a bit about the script, we start to modify it, by employing a function to reduce and reuse code.


Now we go and look at some web resources, a good place to find some help.

2 questions

PHP Example Quiz

Example File Zips
Section 4: PHP By Coding

Now we are going to learn PHP, by building a script.


Let's look at a design template.


Lets turn some code into a function.


This is my most valuable too, the syscall function. Let's learn how it works, and what it allows us to do.


Let's replace the system call with syscall, and measure the result.


Look at ways to implement flexible array processing.


Add a search variable, so that you can easily change what you are searching for.


Instead of one search term, turn that into a passable array.


We look at another way to loop through an array.


Utilize command line arguments to add flexibility to your program.

4 questions

PHP Coding Quiz

Coding File Zips
Section 5: PHP By Conversion

An introduction into converting a bash script into a PHP script.


Lets take a look at the bash script we are going to convert.


Convert commands to variables.


Use this PHP feature to debug arrays.


Add the Convert FD functionality.


We adjust PHP to match the output formatting, so we get the same functionality as we did with the bash script.

2 questions

Conversion Quiz

Conversion File Zips
Section 6: PHP Real-Life Use Case

Let's talk about a real-world use case, and discuss how to solve the problem.


Here is a script, which makes a config file, that the main script will use.


To view the config file, we write a short script to display its contents.


Now we take an in-depth look at the main script, and see how to access the data in the config file.


Here is how to configure PHP to send mail. This library works great!


Here is where I got the mail library from, download yourself a copy as well.


Here is a look at the contents of the zip file, so you can examine what the output files look like.


It is always good to use a debug file, this catches all the standard output from the cron job.

4 questions

Real-World Quiz

Real-Life File Zips

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Sam Gill, Instructor, Sr. Consultant, Executive Director, Producer

I have been making music, since 1992. I have 3 labels, and 2 bands. I have programmed and written over 800 sequences, and when I have time, write about 80-100 songs a year. At one point I owned 19 keyboard synths, and 20+ synth rack modules. I used to record and arrange on a setup that consisted of a 24 channel Soundcraft, with 3 DA-88's and a Roland MC-50Mk2. I came to Logic and Apple in 2007, and picked up Ableton Live in 2009. I sold most of my hardware, and bought in to soft-synths, after I sampled my most used sounds, and was able to reliably use those. I continue to write to this day, and keep learning new techniques, and new ways to improve my music. Now that I have amassed such knowledge, I have found the joy of sharing what I know with others who can benefit from my years of experience.

Beside music, I have worked with electronics since 1990, and have built, repaired and fixed many things along the way. I got really sucked into electronics, when my synth passion ignited, and I found out that they need to be repaired frequently. I started repairing synths as early as 1998, learning about the ins and outs of the electronics that they were founded on.

I took an interest in programming keyboards, with my first programmable keyboard, which was a Kawai K11, which I bought in 1992. I did not know it then, but programming a keyboard, and programming a computer, are not very far off.

In 1994, I bought my one and only sequencer, a Roland MC50-Mk2, which I have to this day, and it writes in DD floppy drives. I have a collection of DD drives, since they are not easily found today. I composed over 800 sequences on that sequencer over a 10 year period. I learned how to arrange, and that arrangement method was directly transferrable to Ableton Live.

Since 1984 I also been an avid Photographer, and have invested in cameras, lenses, video equipment, and other sorts of gear, to not only share what I know, but how I think. Over time I have also developed a deeper spiritual sense, that has come to offer comfort, to those I hold dear, and has helped me to achieve peace within myself. I have published my photography works, and use my photography skills for a number of different uses. I also will have courses on photography and video techniques, to share, ones that I have learned over the years.

In 2007, I began to build up my contemplative skills, and began to think more about the world, and who I was. In 2011, I was forced to speed up this process, and went through a number of breakthroughs, and revelations. In 2013, and into 2014, I experienced spiritual awakening, in new and different ways, and had a lot of my beliefs turned upside down, or replaced, or expanded. As you may have guessed, I have now a lot to talk about on this issue, and I will be making courses for self-development, and personal development, along with helping you to understand some of the things that you may be going through, and how to cope or grow beyond them. Hope is always possible, in all situations, and a better outcome can always be pursued.

If you have a course that you would like me to teach, just send me a note, and I will add it to my list. I am always looking to help others, and mentor people, as I have the time. I hope that I have been able to help you, and grow your skills and talents, as you look for ways to express them.

I hope you enjoy watching and learning from these courses, as much as I enjoy teaching them. Be well, and take care my friend.

Ready to start learning?
Take This Course