Change PHP version of default virtual host

Regarding your first answer, it is a web application and it IS IN A VIRTUAL HOST, one that I created from Cockpit, using “Create a Virtual Host” and that is also where I installed PHP 8.0 from. So what I don’t understand is why my application still sees PHP 5.4. This is actually my issue, sir. If I run phpinfo.php from either directory, either /var/www/html, or from the new virtual host directory /var/lib/nethserver/vhost/8d15d07d4a7a726/, it gives me the same version of PHP, 5.4

please use the command above and you will see that to use PHP80 you need to use another binary

Well, I ran the above and it says "Package nethserver-remi-php80-php-fpm-1.0.0-1.ns7.noarch already installed and latest version
Nothing to do
[root@server ~]#

This is how PHP-FPM works, you do not modify the default PHP version, you just install how many other versions you need. On /var/www/html it will be always PHP54 except if you customize your installation.

Ok, can you please explain how to customize my installation please?

1 Like

You need to adapt the tcp port of the tcp port of the relevant php-fpm version you use

For php80 it is 9008 tcp port

I do not have any reverse proxy settings and how would I share my virtual host settings please?

To output your virtual host settings on command line:

db vhosts show

I can’t reproduce. If I set PHP8 in the virtual host and then browse to https://<virtualhostname>/phpinfo.php I get the right PHP version. To browse to the virtualhost you need to browse by name not by IP.

How do you run phpinfo.php? Command line or browser?

2 Likes

Well, there I also have a problem, I cannot browse by name internally, only by IP. I run phpinfo.php through a browser

That’s the problem. If you go by IP you go to /var/www/html/ which has PHP5.4 by default.

If your clients use NethServer as DNS server you could add an alias name. If you use another DNS server then you could add a DNS entry for the virtualhost name pointing to the NethServer.

1 Like

Well, I’m using an external DNS server at my ISP that has all my DNS records set, and the relevant ones all point to my server.
But I have picked up an additional issue, so I will be re-installing Nethserver in any case. Thank you for your assistance

1 Like

I am not sure you faced an issue that it needs to reinstall the server, I guess you are in a learning curve and I think you still need to grab more additional informations on how the network works for your understanding.

do not be shy we all faced one day this situation.

you should read the documentation of NethServer Administrator Manual — NethServer 7 Final and also more documentation on DNS, by the way, a domain name can be set internally by your router (or your NethServer if you use it as a DHCP server)

1 Like

Thank you, sir, but I know very well how DNS works and my DNS setup at my ISP is working perfectly fine. DNS has nothing to do with the PHP issue. I am very experienced in editing Linux configuration files, as I have experimented with various versions of Linux. My only issue thus far with Nethserver should have been relatively simple to resolve, by editing a certain *.conf file. It seems not to be the case. Or alternatively make an option for the default virtual host to be either edited, or removed and/or replaced by by a custom one. In other words a bit more configuration freedom. Yes I am in a learning curve with Nethserver and I appreciate that this package is unique in its own right and I applaud that and as I mentioned in my original post, I love it, it just works out the box. However, it does seem that an issue has raised its head that I cannot seem to fix, so for me a re-install is the simplest option.

1 Like

Hello @markdewet

Welcome to the NethServer community, first of all.

And thank you for exposing the fact that your understanding of DNS is highly limited.

You pretend or assume that an ISP can resolve internal IP adresses, like your notebook or network printer?

As such, it seems you do not quite understand how SSL Certs work. Or that certain (Especially PHP and JAVA Apps) require VALID SSL certs?

Maybe this statement explains it all, equating experimenting and unreflected self-teaching to actual experience and know-how…

My 2 cents
Andy

NethServer uses also a template system to overwrite your custom edit of certains configuration files you could do. It is efficient so when you edit a file take care of the warning at the top of the file

You will love too ns8

Good day, Andy, No I do NOT assume that an ISP can resolve internal IP addresses, that is what virtual servers on my router handle and these are also correctly set up as my website and email are resolving and displaying correctly. Please also note that the issue of not being able to connect internally to my domain using FQDN (in this case www.gmcomputer.co.za) is very trivial to me as it is working correctly from an external PC, so to me internal is not important. Regarding SSL certificates, I am not sure why this was brought up, however, if you wish to check, you can go to www. gmcomputers.co.za and confirm I indeed have a valid SSL certificate.

Hi @markdewet

At the moment, your website https://www.gmcomputers.co.za/ seems unreachable…
I do see the Google references / links etc., but the site is unavailable for me at home, nor from other PCs / Servers I have access to at other sites…

This is probably a non-issue, or a small outage…

In german, there is the term “Vorführeffekt”, as germans can concatenate nouns (hook up several nouns to each other). This does not translate too well to english, the appropriate in two words would be “demonstration effect”…

It seems, you called the “demonstration effect” by asking me to view your page, and promptly it isn’t available…

:slight_smile:

However, due to the fact your page isn’t available, I can’t check the ssl certs, nor can I check if it’s running on a NethServer, or even where it’s running from.
Is your website hosted externally, or self hosted?

Note:

I generally advocate external hosting for my clients, as a generic website can eg be attacked with DDOS (Distributed Denial of Service) attacks, which would at the same time render any internet communication, mail, VoIP from that company to be impossible.

Offsite hosting for a generic website eliminates that “gotcha”.

Correct setting of DNS internally and externally is known as split brain DNS, and is “the way to go” in networking, corresponding to “best practices” in DNS.


As mentionned by MrMarkuz above, viewing the Website via IP or via Hostname will provide different vantage points. Only using the hostname will you be able to see the correct PHP version for the virtual host environment. And that is, again, also dependent on correct setting of SSL, virtual Host and other factors.
So checking by IP for the right PHP version is like adding in the date when calculating the bill.
It has NO relevance to the PHP your App would be using!


These two statements from your posts above are extremly contradictory:

“I am very experienced in editing Linux configuration files, as I have experimented with various versions of Linux.”

and

Sorry, but the statement “experimented with various versions of Linux” disqualifies you as a pro

Your website impliies a professional use case (IT shop…), so a professional use…

→ A pro does NOT experiment, that’s not “professional” and clients don’t like being treated as guinea pigs

You don’t even seem to know the basics of name based resolution in web servers like Apache - using IP for checking will not work…

I find here in your post too many conflicting infos and a general refusal to listen to good advice.
Too difficult to provide help… :slight_smile:

Still, I wish you good luck with your re-install!

My 2 cents
Andy

Regarding your various statements, I am amazed that you “assume” a lot of things. Firstly, I never once “presented” myself as a “pro”, I am simply a person who has experience with Microsoft Windows and enjoy tinkering with Linux. Regarding my website not being available, we have in South Africa something called loadshedding, where the electricity is cut in order to prevent a total blackout in the country (read the news sometime). This is why my website was not available. It is now available.
Regarding the internal name resolution, I simply had to change my hosts file on my Windows PC and guess what?? IT WORKS!!! I can now access www.gmcomputers.co.za AND mail.gmcomputers.co.za. AMAZING!!!
Oh and by the way, the application I wanted to get working is now working, it seems I just had to reboot my Nethserver PC.
I do host my website from home. Is that not something a “pro” should do???
I did not have to re-install either, by the way.
Anyway, the end result is that everything is STILL working as it should and I am happy. I am now looking to get my SSL certificate for mail.gmcomputers.co.za installed. My next quest.

1 Like

Hi Mark

  1. I wasn’t “assuming” things, I was just trying to “deduce” from your statements what you were trying to do and where / how.

  2. The Tip with the hosts file in Windows is the proper way to test a Website with name-based hosting. That it works isn’t surprising or amazing.

  3. Hosting from home has a few issues. I used to do that, but too many attacks from “untrusted” places, like Russia, North Korea, or Brasil… Any simple DDOS (Even a DOS) attack can completly block your site if running from home. You may not be aware of it, but a simple PING can be a couple of hundert megabytes per PING (!), depending on bandwith the attacker has. (PING has options…!)

  4. If using LetsEncrypt, you can use a single cert and set Aliases for any other hostnames the cert has to react to. Add these aliases in under Aliases on the NethServer Cockpit page, have the DNS point both aliases to your NethServer, than do the LE request with the aliases added in.
    Easy & Quickly implemented - can be thought of as set & forget!

As I see from your (now working) website, you’re using paid SSL certs. Any specific reason? LE works just as well - or even better, as bought SSL usually never changes during the year, LE changes the certs every 3 months.

  1. I am aware of the global energy situation. Even in “rich” Switzerland, the government is preparing for the expected Winter Energy shortage. In our case, it’s specifically because of the french shutdown of over 50% of their nuclear power stations, Switzerland has no Coal or Gas power generating stations. We have Water, Oil and Atomic Power.
    A lot of countries world wide have major issues due to the price explosion in the energy sector, add to that the war in Ukraine (Gas price!) and generic global shortage…
    Some countres call it loadshedding, in others it’s called brownouts or even blackouts…
    Electricical power, if not used, is generally “wasted”. If power is overused (Too much demand) brownouts / blackouts happen. Loadshedding is trying to do it a bit more “controlled”, either by region, city quarter, or whatever.

  2. You may have noticed that here on the NethServer platform, there are a lot of people willing to help! However, we’re not good mind readers or telepathic endowed, so we need info on the wherewithall of your setup / situation. Statements like “The Internet isn’t working” don’t really help, as this is too generic (And wrong anyways, as I doubt that there’s any global internet outage going on, like that statement implies!).

You yourself stated the following:

These two statements do give the impression of a know-it-all (Not really a pro!)…

Please note:
I do NOT have the intention to criticize you, but am trying to assist, like so many of us here in the forum. However, we do need infos from your side!

I do hope you have a good experience with NethServer (Any version!), and if any other issues crop up, don’t hesitate to ask! (But do provide enough info!).

My 2 cents
Andy