1

I am trying to learn how to set up a (vps) hosting with apache2, php5, mysql, redis, mongodb, and whatever other dev tools.

I am going to practice this trought "Vagrant(up.com)". I want to use CentOS, but for now I am playing around in the default "box" wish is "Ubuntu 12.04".

Installing apache2 is not that diffecult and MySql is not as well. Put with setting up PHP proberly is another story.

I found one way of installing newer php version trough http://debphp.org/. Is this the only way? How do hosting company's solve this?

Now my real question. So I can install php5.4+, but what I would really like is having both 5.4 (default) and 5.5. I would like to enable PHP 5.5 trough a .htaccess file like I can with my current (shared) hosting.

For example:

# .htaccess
AddHandler application/x-httpd-php55 .php

I would like to do the same thing, but I don't know how. I have tried google, but I don't know what keywords to use. I tried a few, but without result(s).

Does anyone have a link or knows a book (doesn't have to be free) where I could find this? The only thing I found is: Conditional PHP Version in .htaccess. But the answer is to short to really understand what's happening.

FYI: I am no Linux Terminal expert (yet :) ) and I don't know much about apache2, but that doesn't mean I am not trying to learn it.

Edit: Actually, I am planning on using Nginx once I am ready to have my own VPS, so if people know a way off doing that on that program as well then feel free. Eventually I want to learn how to use/configure both anyways.

1 Answer 1

1

You will need a parallel installation of PHP then user can select their desired version of PHP with a handler directive in their .htaccess file such as the following:

# PHP 5.4
AddType application/x-httpd-php54 .php

# PHP 5.5
AddType application/x-httpd-php55 .php

Installations such as these are custom and require the ability to install packages and configure them for use with with Apache via modules which if you are unfamiliar with are not easy tasks. I would recommend purchasing a cPanel license either from your hosting provide or from cPanel directly as the software will make managing the softwares (Apache, PHP, MySql) alot easier and allow for simple click configurations for the items you are needing. It will also allow you to spend less time configuring the server and more time actually working on the websites as with a web server that is your ultimate goal.

Sign up to request clarification or add additional context in comments.

2 Comments

cPanel is not a option for me yet (want to learn to basic and I don't make a profit from this. More like a hobby :)).And I think I know how to install php in parallel. Building php from source with the required configurations (wiki.helioviewer.org/wiki/Compiling_PHP_from_source_on_Ubuntu). What should/can I read to know more about Apache modules.
Tnx I will have a look. I just build the latest apache in centos. I have got it running, but just need to see the famous apache default page. But thats probably because of vagrant (not shared the folder).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.