Solved

I'm installing PHP on a server. What do I need?

Posted on 2014-12-23
22
136 Views
Last Modified: 2014-12-29
Anytime that I've installed PHP, it's always been on my box. If I was using an ISP, they always had it in place as an option I simply chose. So, now I'm being asked by a co-worker who's setting up PHP on a Linux server "What do you need?"

I'm assuming the answer would be to simply download LAMP, just like you would WAMP (http://www.wampserver.com/en/), but there's the issue: I don't see that kind of option with LAMP.

So, my administrator sent me this email, asking if I needed anything else. Not sure what to tell him and was hoping someone with a mind greater than my own could look this over and tell me whether or not anything else is needed.

Thanks!

Going to install:
                crontabs              - http://www.crontabs.org/                                                                       - scheduled tasks
                redhat-lsb           - http://www.linuxfoundation.org/collaborate/workgroups/lsb- linux standardization
                sysstat                  - http://www.systat.com/                                                                           - ? charts
                webalizer            - http://www.webalizer.org/                                                                     - web server log file analysis
                php-ldap              - http://php.net/manual/en/book.ldap.php                                       - ldap for php
                php-mysql          - http://php.net/manual/en/book.mysql.php                                    - MySQL for php
                php-mbstring    - http://php.net/manual/en/book.mbstring.php                              - multibyte strings for php
0
Comment
Question by:brucegust
  • 9
  • 5
  • 4
  • +2
22 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40515188
Unless you have specific requirements in PHP then the default install is fine.
0
 

Author Comment

by:brucegust
ID: 40515190
Hey, Gary! That's what he has listed above, correct?
0
 
LVL 58

Expert Comment

by:Gary
ID: 40515196
I don't see any mention in the list of LAMP but the default LAMP config should be fine for the install then you need to secure it (the default setup is not secure)
Also no mention of a firewall
0
 
LVL 8

Expert Comment

by:Brandon Lyon
ID: 40515247
I'm not really sure what is being asked for. If you need PHP then the answer is install PHP.  What is the end goal?

Are you trying to run a website? Do you need phpmyadmin as well as a database? Are you just trying to get a PHP script running which requires a certain version of PHP? Do you need any specific plugins or frameworks?

LAMP usually stands for Linux, Apache, MySQL, PHP. WAMP stands for the same thing but with Windows instead of Linux. Those could be configured and running with virtually any combination of plugins and settings.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40515313
If at all possible, you should be using the packages created by the Linux distribution that you are using.  I think all of the things on your list are either normally available or available thru  the 'repositories' for that version of Linux.  If they are not available, the normal method for installation on Linux is to download the source code, compile it and install it yourself.  I do not recommend that you do that.  The distributions of Linux vary a lot more than the versions of Windows.
0
 
LVL 58

Expert Comment

by:Gary
ID: 40515347
Is there any reason you are using RHEL and not Centos?
My setup with Centos would be install ISPConfig and you are done.
0
 

Author Comment

by:brucegust
ID: 40515417
I'm not doing the install. It's a guy that's working remotely, so I'm able to look over his shoulder and see what he's doing. In the past, anything that I've had to install was a slam dunk just by grabbing a package like what Dave suggests. To things broken up into specific elements and then being asked if "Do I have everything?" is outside my comfort zone.

Is there an equivalent to WAMP for Linux servers? What's the "package" for LAMP scenarios? Or what do I need to tell this person? Is the fact that he's got "pieces" listed indicative of a flawed approach?

Bottom line: I've got a couple of administrators who are .NET guys who need to install PHP and MySQL on a Linux server. The "reports" that I'm getting back are "MySQL's not working" and other comments that suggest there's a simple approach that they're blowing right past and I don't know what to tell them.

What do you think?
0
 
LVL 58

Expert Comment

by:Gary
ID: 40515424
0
 

Author Comment

by:brucegust
ID: 40515469
Gary, go with me here, 'cause I'm an ignorant rabbit...

I'm assuming this is what you're referring to: http://www.centos.org/. What do I need to tell my guy?
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40515476
I don't think you are understanding the 'package' concept on Linux.  Each distribution and in particular, each major distribution, has it's own way of arranging the file system on Linux.  Ubuntu and Redhat/CentOS do not do things exactly the same way.  Each though has it's own way of installing it's Own packages from it's Own repositories where their Own versions of programs are stored.

What version of Linux are you working with?  If you can't answer that question, you should step away from the computer and hire someone who can.  Second, MySQL doesn't come up running 'right out of the box'.  You have to install databases, create users, and possibly enable remote access.  That's true on Windows too except when you have WAMP or XAMPP which both come with phpMyAdmin.
0
 
LVL 58

Expert Comment

by:Gary
ID: 40515481
First question is why are you using RHEL?

Centos is the "community version" of RHEL with no support.
I would go with Centos and install ISPConfig then you have a nice GUI for the server and it sets everything up for you
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 8

Assisted Solution

by:Brandon Lyon
Brandon Lyon earned 50 total points
ID: 40515577
Linux is an Operating System. Apache is a program. MySQL is a program. PHP is a program.

I get the feeling that when you say WAMP you're referring to a specific GUI frontend which comes pre-packaged, for which there is not a Linux equivalent as far as I know. Technically WAMP refers to ANY Windows server running Apache, MySQL, and PHP, and not just the interface I get the feeling you're referring to.

MySQL's not working

That indicates that something is not configured properly or that MySQL is not running.

Installing PHP does not do anything for MySQL. They're two different programs. It also doesn't mean that it will be configured correctly by default.
0
 
LVL 34

Accepted Solution

by:
gr8gonzo earned 300 total points
ID: 40515603
First, a clarification. WAMP and LAMP are not packages or software. Those are simply acronyms that refer to a set of INDEPENDENT programs/services that are just commonly installed together:

W/L: Windows/Linux
A: Apache
M: MySQL
P: PHP

Programs like WAMPServer, EasyPHP, XAMPP, etc... are not products by themselves. They are just installer programs that have bundled these other programs together in a way to make it easier to install on Windows.

Linux might have some installer programs, too, but you really don't need to use them. Linux itself is a really REALLY lightweight operating system. Linux distributions like CentOS and Ubuntu and RHEL are basically Linux with the addition of some bundled applications and sometimes some easy ways to install software via "package managers" - sort of like installing software on a phone from the Google Play Store or the iTunes Appstore. Different distributions have different package managers. Ubuntu uses apt, while CentOS uses yum, for example.

Now, Linux servers often have the ability to compile source code into the final program for your use (again, depends on your distribution and/or what development software you've installed), so applications like Apache will often offer you the source code in a tarball / gzipped (or bzipped) format for you to download, compile, and install. However, this isn't always the simplest way for most people. So the people over at Apache also compile versions of their source code for you, set some default configurations that will work for most people, and put the final result into packages called RPMs (there are other package types, but that's the most common one - it's like a ZIP file). This way, you can download an RPM from their website and install it on your system and it's ready to go.

A package manager like yum makes things even simpler. Package managers usually tie into repositories. The people over at CentOS will know that Apache has an RPM and will download it and put it into a huge file system called a repository. Then you can just tell yum to install Apache ("yum install httpd") and it will download the RPM and install it for you in a couple of keystrokes. The nice thing about these package managers is that the people over at CentOS and the various other package manager maintainers will also update the RPMs in their repositories from time to time. So you don't have to keep checking Apache's website for updates. You can simply tell the yum package manager to update ("yum update") and it'll go figure out what updates are available and handle all the downloading and installing for you. So if Apache and MySQL both  have an update, yum can download and install the new versions, preserving your configuration - all with a single command.

It'll also automatically figure out any dependencies (any other RPMs you might need to install) and install those, too.

So if you wanted to set up a LAMP server, you could install CentOS, and run:

yum install httpd
yum install mysqld-server
yum install php

...and you'd have a very basic setup. There are other plug-in modules that will extend php's functionality, and tie it into the Apache web server and MySQL server, etc...

There is a downside to using a package manager. With the ease-of-use and ease-of-maintenance also comes slower updates. If someone finds a big hole in Apache and they release a new patched version, it won't always make it to the repository right away. So you might be exposed for a while until the repository receives the new version.

For this reason, sometimes people will use package managers to install some of the basic libraries that the system needs, and then they'll install any mission-critical components via source or via the RPM straight from the author's web site. For example, I use yum to install and maintain the libjpeg library that is used by PHP / GD for dynamic image generation. However, my CentOS repository doesn't carry PHP versions past version 5.3, so if I want something more recent, I have to either use a different repository (which can have its own series of complications), or install PHP manually by myself. I usually take it a step further and manually compile PHP, MySQL, and Apache so I can be very specific in where I put the files, and all of the options that I want. It's not as easy to update/maintain, but it frees me from depending on a repository for important security updates.

Since Linux is literally like a friggin' toolbox that lets you do all sorts of things, you'll probably see people who say that you can configure it to work XYZ way so that it updates this and that way, and that's all true. There's usually more than a dozen ways to do something in Linux, so it comes down to personal preference in the end. Do you want to use a package manager? Or install RPMs from the author's website? Or download/compile the source instead? Maybe a mix? Maybe use a wrapper application like ISPConfig that Gary mentioned? It'll all be up to you. Linux = a lot more research when installing components, so make sure you read up on the things you're installing so you understand what the system is doing.

There are also some system administration tools out there that can help simplify maintenance (I prefer Webmin with the AJAX interface that you have to install separately) and give you an overview of the system. Just remember that as you add things to your server, you also have to ask yourself if those things are properly locked down from the public. You don't want Joe Schmoe being able to access your Webmin interface, for example.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40515783
That's a good post by @gr8gonzo.  Setting up a Linux server in my experience is not like installing WAMP or XAMPP on Windows.  While the package manager will install all the things you need (in their standard configuration), you will still have to go in and configure quite a few things.  It isn't going to just "come up and run".  Maybe the package Gary mentioned will do that but I haven't seen that on the 3 different distributions that I have used and installed.
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 100 total points
ID: 40515792
The point of the packages is that they will just get everything installed correctly without worrying about versioning or dependancies.
All being well you could then manage everything else through the GUI (talking about ISPConfig here) after initially setting up the environment and installing it.
It's about a 20 minute job if I remember.

I've tried other like Virtualmin etc and always found them buggy and hard to manage or something gets fecked up when add a new site or update something, whereas ISPConfig is on par with cPanel for userability.

edit
Of course that is excepting the finer tuning of the server like firewalls, SSH key authentication etc etc.
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 50 total points
ID: 40515811
Of course that is excepting the finer tuning of the server like firewalls, SSH key authentication etc etc.
That's what I was referring to.  Setting it up and maintaining it for a public site is a full time job.  All of the major hosting companies have their own admins and programmers to keep their Linux machines running safely.  For security reasons, they usually compile their own versions of PHP that leave out things they consider to be security risks that they don't want to take.
0
 
LVL 58

Expert Comment

by:Gary
ID: 40515815
If you have everything set up right and tighten down the server then you can pretty much forget about it apart from the occasional update and security fixes as they come along.


I've yet to have anyone hack my server and they try everyday.

edit
And make sure any clients are isolated. You can never account for stupidity.
0
 
LVL 34

Expert Comment

by:gr8gonzo
ID: 40515860
One additional note on package managers and dependencies - part of the reason I don't use them for mission-critical things is that package managers tend to overdo the dependencies and end up linking everything together. So if you later need to remove a dependency library, it can sometimes try to remove other packages that are linked to it. More often than not, it wants to remove things that you don't want to remove, forcing you to try and piecemeal the removal process.

So my own recommendation is to only use package managers to install things that you know you are never going to want to remove later.

Example: When I was a Linux newbie, I used a package manager to install everything. This was back in PHP 4 days and when PHP 5 came out and got stable for several months, the repository still didn't have a PHP 5 package. Since I didn't want both PHP 4 and PHP 5 on the system, I wanted to remove PHP 4 from the package manager. However, the package manager wanted to remove Apache and MySQL, too. I forced the removal of just PHP 4 and later when I tried to update the Apache and MySQL packages, the package manager wanted to re-install PHP as a dependency.

I think that most package managers have improved since then, but I still see that in yum sometimes. I think apt is slightly better, but I don't run a lot of Ubuntu (or similar) servers.
0
 
LVL 58

Expert Comment

by:Gary
ID: 40515872
Never had a problem with ISPConfig, it's not so dependant on what is installed even though it installs everything for you, well the basics, apache, mysql, bind, postfix, dovecot off the top of my head, you can switch to nginx, you can do php versioning per site.
Now if you removed MySQL, for some strange reason, you would feck the GUI up.
It's a pleasure to use, even though I still do a lot of CLI work.

Others like Virtualmin I think you have to do all updates within the GUI using their own modded versions - which is not nice

edit
I think it uses the EPEL repo so a safe way to update
0
 
LVL 58

Expert Comment

by:Gary
ID: 40515873
And now Bruce is more confused than ever!
But great discussion - maybe should make it a real discussion.
0
 

Author Comment

by:brucegust
ID: 40522395
Thanks, folks! It will take a while to digest everything but the bottom line is that:

WAMP and other similar services are not software packages in and of themselves, rather they are bundles of standalone apps / software

Linux offers a whole new world of opportunities and options when compared to its Windows counterpart

While you can take a similar approach with a Linux server, as far as using a service that bundles things together, taking the time to really understand what you're trying to do and then using a command line approach, is probably your best bet.

Does that sound right?
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40522510
While that is an interesting viewpoint, it implies that you have a lot of time to learn about things.  I installed and use the 'desktop' version of Ubuntu and added the server features.  With the Gnome GUI, it is much easier to navigate thru things.  On the other hand, I'm pretty sure the production servers I use for hosting only use the command line.  But hosting companies have other tools to make it easier to configure and manage their servers.  They are not sitting there "at the command line" doing everything one by one on the thousands of server that some of them have.

One of the first things you should learn is that the 'easy' way is to use the packages provided by the distribution because they are configured to run with the other packages.  If you don't use the packages, then you are expected to download source code and compile it for your machine.  Then you have to know or find out where your distribution puts things in the file system.  No... they are not all the same.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now