LAMP on SUSE

Dear Geeks,

I used Suse since 2001, but in last time I need support for multiple version of PHP, MySQL and web server on same environment for development. I wrote small bash script for the automatic switch PHP, but before start using that script I manually unpack RPM PHP files.

As I can see (in RPM files), each PHP version is in separate directory. We should need to adapt directories for subversions in RPM packages.

I do not know where I should write this post or ask who where I can help about this but open this thread.

Many Full Stack developers need easy usable LAMP on the Suse. I want to help as I can and know.

Initial script for switching PHP version is on the Github:
https://github.com/Kolesar/sphp

But, I want to see script in official RPM package by Suse

Are we talking SUSE or openSUSE ?

You can use the credentials here to login on build.opensuse.org and create a package for the switcher.

Adapt microservice style development; use containers for nginx/apache/php. Much easier than maintaining 10 different php versions.

@Knurpht
About open of course :slight_smile:

35
@Miuku
I do not think so. Much easiest is just switching PHP/APACHE/MySQL with small script than create all microservice infrastructure, specially for beginners who want to develop, not administrating their machine

Something else: I would replace the ‘service apache …’ commands by ‘systemd status apache2.service’ etc.

I agree.
There is probably little reason to switch between PHP versions since each website you build will have to be matched with only one version.

So,
If you want to build several versions of anything on one machine, virtualization and/or isolation can be your friend.

You can use containers as Miuku suggests,
Or you can use any virtualization technology like Virtualbox,(recommended), VMware (also reommended), KVM, Xen (both less recommended for personal workstation use), or many more.

With any of the above choices, you can build an isolated, self-contained running instance where everything within it won’t conflict with everything outside of that machine. You can even run multiple machines simultaneously which can be useful when developing web solutions.

I touched on this recently in a post to the Virtualization Forums

https://forums.opensuse.org/showthread.php/529566-Web-Development-Docker-KVM-Virtualbox-Decision-helping-hand

hth,
TSU

You might consider creating a PHP alternative which can be configured using update-alternatives in place of your script.

The alternatives method is fairly simple…
“update alternatives --config” is a master switch for switching between symbolic links referencing your root binary or configuration.

So,
For instance I wrote the following Wiki article which describes how to switch between installed gcc versions…

https://en.opensuse.org/User:Tsu2/gcc_update-alternatives

There is plenty of documentation, guides and examples nowadays for creating various alternatives including the MAN pages and help.
And, that’s besides the many existing alternatives already configured on your system.

TSU

On Tue, 13 Feb 2018 14:56:02 +0000, Motokultivator wrote:

> Much easiest is just switching PHP/APACHE/MySQL with small script than
> create all microservice infrastructure, specially for beginners who want
> to develop, not administrating their machine

Actually, if you have docker installed, you can pull pre-installed LAMP
containers that require no setup at all - just pull, run, and start
developing.

It doesn’t get much easier than that. I spent the weekend doing a little
bit of work with just a couple Apache docker containers, and getting the
instance running was literally zero configuration.

I needed to add a few things to it for my particular use, so I had to
learn how to build a Dockerfile, but again, super-simple to do and didn’t
require any knowledge of how to configure Apache. I just used the
httpd:alpine container, but the registry has several LAMP containers
available to pull.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

As I can see from you posts, you are not developers :smiley:

I agree and disagree in same time with you. If you know what is the brew and how it works you will know about what I speak. I have idea to make it much more easies for end developers than brew.

Brew is originally made for MacOS and later is ported for Linux, but many thinks does not work very well and it is really complex system. No one developer need something like brew (compiling every time what we need on the system). Everyone want something with just few commands or mouse click. We as a linux experienced users and developers have a chance to help many people all around the world if we want of course.

With containers and virtualization everything is easiest (mostly) after you once set environment, but for that MUST HAVE really strong machine to handle all over it on first place and configure every virtual machine from scratch (for web developer other distributions are easies configurable than suse, but I speak about suse here). For example, currently I used some web applications for development where I need minimum 8GB RAM for run. If I will move it to the virtual machine what I will get? Nothing! How I will coding there. I as a developer must know how to share web directory with host machine and so on, and so on. Many developers are not linux expert, but want to use linux!

With just few scripts and adapt RPM files we will solve all issue with that. That is very easy to make it. Question is do we want to help or not to ourselfs and whole current and feature (absolutely beginners) linux users.

Stop thinking as linux expert, try to think as absolutely beginners who want to use linux and develop on it.

You misunderstand me and my background (I have done development work in
the past, actually - and work for a software company).

Install docker:

sudo zypper in docker
sudo systemctl start docker

Then use docker to pull the apache image:

docker pull httpd:alpine
docker run -dit --name <containername> -p 8082:80 -v <localpath>:/usr/
local/apache2/htdocs --restart=always <imagename>

Then just put stuff in the local path you specify in the -v parameter.

Done - that’s all there is to it. No Linux expertise needed. You can
literally have it running in less than 5 minutes with zero experience in
configuring the apache httpd server.

Do you need to perhaps read a little bit for something more like LAMP?
Sure, because LAMP is not a simple infrastructure to set up in general.
That said, a:

docker search lamp

Turns up a number of pre-configured docker containers. Checking them out
in the docker registry first can give you an idea of how much work it is
to get up and running.

You don’t need a very beefy machine for a single-container setup like
that. I use Virtualization every day (both in the cloud and on local
systems - containers and VirtualBox VMs).

The overhead for using docker is negligible - yes, if you need a ‘beefy’
setup, you need a host with enough memory. The beauty of a docker
container is that there is no configuration necessary for something like
a standard LAMP stack. All it takes is literally just following the
container provider’s instructions on how to set up the volumes that are
shared with the container (that’s the ‘-v’ parameter).

Developers shouldn’t be afraid to learn something new once in a while.
The ones I know and work with aren’t - and they see the benefits of
containerized development. Makes having multiple versions of things a
snap, and it’s easy to deal with and set up.

I was initially apprehensive about using Dockerfiles (which is a slightly
more advanced usage of docker - and can become much more complex) - but
what you’re looking for is a truly simple setup, and it’s a great choice
for that because you don’t have to build the images at all.

And what you get is more than an isolated environment with low overhead -
you get reproducability. If you do muck around inside the container
(which you can do - launching a shell is an easy ‘docker exec -it
<containername> /bin/bash’ away), you can recreate the container by just
re-running the ‘run’ command.

Simple.

Look into it - you’ll see that it’s not as difficult as you’re making it
out to be.

Jim

Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

I must say, I agree with that.

And I do not need any against with new technologies, but why we do not have multiple solutions.

However, if most people do not want use what I say it is ok for me. In that case I thinking in wrong way, and I really appreciate it :wink:

On Thu, 15 Feb 2018 09:16:01 +0000, Motokultivator wrote:

> And I do not need any against with new technologies, but why we do not
> have multiple solutions.

The beauty of the open source community is that anyone who wants to
create a solution and share it can - people often do this to ‘itch a
scratch’ they have.

So if you have a different way to do it, committing it to the build
service and making it available to others is absolutely encouraged. :slight_smile:

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

Although Jim already countered, I’m also throwing in my 2 cents (or farthings, bitcoin or whatever)

Regarding how “beefy” the machine has to be to support virtualization as a development tool,

Actually hardly any effect.
Typically, you should only be running as many machines simultaneously as needed for your immediate use. That might typically be only one, two or three approximately depending on what you’re building. And, if you’re building a typical client/server web solution, you should probably need to support only a single client. And, depending on what you’re building you might even take this a step further deploying a script-based web server like nginx or a javascript webserver which processes web requests and session state very differently than a more resource-hungry apache webserver and/or MySQL/MariaDB.

So, on an 8GB machine you should be able to run 2 virtual machines comfortably for Web development while still for instance using the HostOS machine as a generic client without any special alteration. I can remember only one project where I needed an enormous amount of RAM and that wasn’t a web solution being built (or rather a web interface was only a very tiny part of the solution), it was an early test parsing data analysis engine which required about 1.5 Gigabytes of Eclipse plugins to just be set up. Even today, similar solutions are now built over a distributed architecture and typically don’t require such a complex and enormous backend.

So, for instance whereas you’d never consider running a Production LAMP on 2GB of allocated RAM, I do that all the time for Web development, with either a MinimalX/IceWM, XFCE or LXQt Desktop. Anything virtualized can be adjusted higher as needed later.

As for using Brew,
You can make any Development decisions you wish, but personally I don’t know anyone who uses Brew for project and workflow management… Instead, typically I see people do one of the following

  1. Use an IDE
  2. Write management code using whatever code they’re already using
  3. Particularly for web projects that use community frameworks, workflow and build management apps like Gulp and Grunt

The third option above is very popular because it supports what I opined many years ago that “JavaScript is the language that will rule the world.” It’s already probably <the> major web coding language as part of the HTML5/CSS/JavaScript architecture, and if you use these tools your entire build environment is portable to any platform (other distros, Windows, Mac, more) and there is a good chance your entire setup will run without installing anything new (compare to whether others will already have Brew installed)

Not thinking as a Linux user, in this case thinking purely in terms of Website Development,

TSU

Thanks I got mine working though there’s a lot of scrubbing / trial & error but at the end it was a good learning :slight_smile:

Use containers for nginx/apache/php