Skip to main content
Help Center
The GoDaddy Community will undergo maintenance starting on Tuesday, August 3rd at 3pm PST / 6pm EST. Learn more
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
PaddyLandau
Helper II

Server running wrong PHP version when connecting via SSH

On my account, when I connect via SSH, it used to run PHP version 7.4. That was as it should be.

 

Recently, I upgraded my account, and GoDaddy moved my entire account to a different server.

 

Now, it's a bit bizarre. When I connect via SSH, it still runs PHP version 7.4…

 

… unless I change directory to ~/public_html or one of its subdirectories. Then, it runs PHP 5.4.

 

To be explicit, if I am in my home directory, or (say) one of its subfolders (~/bin, ~/public_ftp, etc.), PHP version 7.4 runs…

 

… except when I change directory to ~/public_html or any of its lower level subdirectories. Then, PHP version 5.4 runs.

 

I have been on the phone to GoDaddy Support three times for (literally) hours. That's Level 1 support, which then communicates to Level 2 support. It was difficult to communicate via a middleman like this, because there were misunderstandings where Level 1 didn't quite understand what I was saying. (They kept referring to me not being allowed to run "power commands" or something like that, which I presume means root commands. That, of course, is how it should be, otherwise it would be a security violation, and has absolutely nothing whatsoever to do with my problem.)

 

Eventually, with some persistence, Level 2 support understood what was actually happening, and they duplicated the problem. They confirmed (still via the middleman) that this is not how it should work, and they'd open a ticket to resolve it.

 

A few hours later, I received an email closing the incident, saying that it's working correctly, i.e. it runs PHP version 5.4 and that's what it's supposed to do. There was no mention whatsoever about version 7.4 running in other directories or the fact that this was a regression over the pre-upgrade situation.

 

Instead, their advice was for me to upgrade.

 

So, in other words, upgrading causes a problem, and the solution is for me to spend even more money?!

 

Nope.

 

I could easily solve the problem by downgrading and spending less money, couldn't I?

 

I'm going to call Support again to reopen the ticket. However, I was wondering if you have some clever fix for this, to let public_html run the same version of PHP as every other folder in my account?

 

If this can't be fixed, I'm going to seriously consider doing what many people have recently been advising me to do: Change provider. That's a shame, because I've been with GoDaddy for many years. This is only the second time I've had a problem with Support, and previously it was because Level 1 (the middleman) resolutely refused to understand my question, which was resolved when I finally persuaded them to get me to Level 2. This time, however, even Level 2 is "resolving" the problem by telling to upgrade further (when downgrading would also solve the problem!).

 

Thank you for listening, and I hope that you have a solution for me!

20 REPLIES 20
Aly
Helper III
Helper III

Hi @PaddyLandau ,

 

I had a similar but not identical issue.

 

Business Hosting cPanel

The shared hosting server runs an earlier version of PHP 7.0.33 than the version loaded under .../public_html/... (currently 7.4 though 8 is available).  

 

cpanel-server-info-updated.jpg

 

The answer given to me by tech support was the server side PHP version is different than the application version you chose to run via PHP Selector.  There is no way for the end user to touch the hosting server root PHP version in a shared VPS environment.

 

php-selector-version.JPG

 

I understand you are seeing a different PHP version via SSH which is different.  Checking this out via SSH (using terminal access) I do see the selected PHP version both at root & public_html directory levels are the same as chosen via PHP Selector.

 

php-version-terminal.jpg

So I guess really I don't have an answer other than they should as you expected match your PHP Selector version.

 

Has this helped?  Probably not, it was just the Server PHP version mismatch that I was trying to highlight.

 

I confirm at least with Business Hosting that you should see the same version as chosen via PHP Selector.

 

Aly

@Aly , thank you for your response.

 

I can't see your screenshots. I've tried Chrome, Firefox and Opera, so I don't know where the problem lies.

 

However, the point is being missed here.

 

I emphasise:

 

In all folders other than public_html, the version being run is exactly as specified in cPanel, i.e. version 7.4.

 

It's only in folder public_html where the PHP version suddenly changes.

 

Look at how this works on my server (I've removed extraneous lines from the PHP results).

 

$ cd

$ php --version
PHP 7.4.16 (cli) (built: Mar 17 2021 18:54:54) ( NTS )
$ cd ~/bin
$ php --version
PHP 7.4.16 (cli) (built: Mar 17 2021 18:54:54) ( NTS )
$ cd ~/public_html
$ php --version
PHP 5.6.40 (cli) (built: Mar 31 2021 00:13:08)

 

See what I mean? PHP version 7.4 runs perfectly, until I change directory to public_html.

Hi @PaddyLandau ,

 

The screenshots are now visible, it takes a while for the community board administrator's to review and approve them. I appreciate that my suggestion of the possible issue turns out not be the nature of your problem.

 

@JesseW made some suggestion regarding the accuracy of PHP version SSH reports.

 

All the best, sorry I couldn't help more.

 

Aly

Hi @PaddyLandau ,

 

A bit more Google research shows the option of editing the .bash_profile using VIM editor to specify the PHP version the SSH shell will use.  I don't know if this will fix your issue but it might be worth a try if you feel comfortable using such editing tools.

 

$ cd ~

$ ls (lists file confirming .bash_profile is in directory)

https://help.dreamhost.com/hc/en-us/articles/214202148-How-do-I-change-the-PHP-version-my-shell-uses... 

 

$ vim bash_profile

https://help.dreamhost.com/hc/en-us/articles/115006413028-Creating-and-editing-a-file-via-SSH

 

Just a thought.

 

Aly 

@Aly Thanks again for your responses. I can see the screenshots now.

 

They all match what I have, with the exception that after

cd public_html

the PHP version returns 5.4.60. It's bizarre.

 

The link that you gave for .bash_profile is specific to DreamHost, because the path

/usr/local/php74/bin

doesn't exist on GoDaddy. I've actually already searched for where the PHP versions are stored, and I can't figure it out. When I enter the command

which php

I get the result

/usr/local/bin/php

regardless of whether I'm in public_html or not. So, something else is manipulating which PHP version is being used.

@PaddyLandau 

So this is a cPanel server in North American Data Center 

1) There is no ~/bin folder at least not that I had access to

2) You said you upgraded / moved to a different account - what did you move from to??

3) Do you have an .htaccess file in the public_html folder that may have an AddHandler line in it??

Also if I understand your issue - you have a script you are trying to run command line vs via apache which is running the correct version

 

Also which terminal are you using as I tried both the terminal on my mac and the terminal on cpanel and both show the directory as part of the output - perhaps you just didn't paste that

 

Screen Shot 2021-07-22 at 5.41.05 PM.png

I am a GoDaddy End User - Just Like You
Check out my site! | I currently manage over 300 WordPress Websites
* Please note that I offer free advice on this forum. Thank You Info If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community

@PL281 — Thanks for your ongoing support.

 


So this is a cPanel server in North American Data Center

No, it's a European server located in France.

 


1) There is no ~/bin folder at least not that I had access to

I created the ~/bin folder, because it's where I store scripts that websites don't use.

 

2) You said you upgraded / moved to a different account - what did you move from to?

Old: I don't remember its name.

New: Launch Business Hosting

 

When I upgraded, I didn't realise that GoDaddy would move my server as well, so that was a surprise. There have been only two problems with this; one, to do with emails, was easily resolved. This one not only hasn't been resolved but also has been denied by Level 2 support.

 


3) Do you have an .htaccess file in the public_html folder that may have an AddHandler line in it?

No, not at all. Here are the results of my run; the red digit indicates the return code indicating that none was found.

 

$ find ~ -xdev -name .htaccess -exec grep -Fi AddHandler {} +
12:00:00 1 ~

 


Also if I understand your issue - you have a script you are trying to run command line vs via apache which is running the correct version

Yes, it's a command line (CLI), not through the browser.

 

If I run it in any directory other than public_html or its children, it runs the correct version. If I change to public_html, it runs the wrong version.

 

Also which terminal are you using as I tried both the terminal on my mac and the terminal on cpanel and both show the directory as part of the output - perhaps you just didn't paste that

I connect using SSH via gnome-terminal. Not that it makes any difference, because it's only SSH access, and I get the same result running from cPanel's "Terminal". You are right, I didn't paste the directory, because I use a different prompt that shows it on a separate line.

 

Below, I've run cPanel's Terminal just as you did, so you can see the results for direct comparison to yours. As you can see, while yours works correctly, mine doesn't.

 

Screenshot from 2021-07-23 12-08-49 terminal.png

 

Thanks again for your efforts.

@PaddyLandau 

 

ok - This doesn't make any sense - one thing I see that is also different is the Zend engine etc  - somewhat to be expected with different PHP versions - 

 

One thing to try is doing an alias - 

@Aly  - FYI - I thought the same thing - the issue is this is all CLI not web based so as such .htaccess /.ini files will not work / fix the issue as those all process via apache

Using an alias to change the PHP version

Add the following to your .bash_profile file.

alias php='/usr/local/php74/bin/php'

 

I am a GoDaddy End User - Just Like You
Check out my site! | I currently manage over 300 WordPress Websites
* Please note that I offer free advice on this forum. Thank You Info If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community

@PL281 — An alias would work, if I could find PHP 7. Alas, your idea doesn't work. Here's why…

 

$ ls -l /usr/local/php74/
ls: cannot access /usr/local/php74/: No such file or directory
$ which php
/usr/local/bin/php
$ ls -l /usr/local/bin/php*
-rwxr-xr-x 1 root root 933 Oct 28 2019 /usr/local/bin/php

 

See what I mean? Whatever I do, I'm blocked from the solution. /usr/local/bin/php returns PHP 7.4 except when in html_folder, in which case it returns PHP 5.6.

 

$ cd
$ /usr/local/bin/php --version
PHP 7.4.16 (cli) (built: Mar 17 2021 18:54:54) ( NTS )
...
$ cd public_html/
$ /usr/local/bin/php --version
PHP 5.6.40 (cli) (built: Mar 31 2021 00:13:08)
...

Hi @PaddyLandau ,

 

I confirm when changing directory to the root 

$ cd /

 

That the PHP location in Business Hosting (Enhanced) account that I am using shows the same result as your 

which php 

 

(PHP binary is shown in top right hand corner).

usr-php.JPG

 

However there is another way of specifying different PHP versions to be used in different directories that *might* work for you?  By using an AddHandler in .htaccess.

 

https://www.fastcomet.com/kb/how-to-set-custom-php-version-per-directory 

 

This could be a quick test the revisit whether the .htaccess fix changes the reported PHP version while in SSH shell.

 

Aly

Thanks for your reply, @Aly .

 


… there is another way of specifying different PHP versions to be used in different directories that *might* work for you?  By using an AddHandler in .htaccess.

Unfortunately, that doesn't work.

 

.htaccess is for website access (i.e. via the browser or equivalent, via Apache), and doesn't affect local running of PHP. It tells Apache how to handle requests to files ending with .php (and, in the examples given in the link, .php5). This, of course, is irrelevant in this instance, because I'm not using Apache to access a PHP file.

 

I tested it anyway just to be thorough, but the result was as expected.

Hi @PaddyLandau ,

 

Bother, this is annoying to say the least.

 

You will likely already have tried this but if not, have you tried switching PHP versions using cPanel's (Select PHP Version).

 

7.4 => 5.6

then back to...

5.6 => 7.4

 

Just in case this will encourage the correct setting of PHP version on your account?

 

If not that then we are walking to an account reset or some such unwelcome / impractical nuclear solution unless you can get higher level support to assist.

 

Your knowledge of SSH shell commands is greater than mine, at this point I am out of ideas, my apologies.

 

Aly

Thanks, @Aly 

 

Bother, this is annoying to say the least.

You don't say, ha ha!

 

… have you tried switching PHP versions using cPanel's (Select PHP Version).

I had tried setting it to version 8 and back again, so I've just tried what you suggest, to 5.6 and back. Predictably, it didn't help.

 


If not that then we are walking to an account reset or some such unwelcome / impractical nuclear solution unless you can get higher level support to assist.

Well, Level 2 confirmed that this was a bug, raised a ticket, and responded by denying that the bug exists, that I must upgrade to solve this (non-existent) bug, and closing the ticket.

 

Well, I'm not going to upgrade again when it was the upgrade that caused the problem!

 

I therefore have three options.

  1. Persuade Level 2 to take this seriously.
  2. Downgrade.
  3. Move to a different provider.

I'll attempt option 1, and if that doesn't work, I'll skip to option 3. That's sad, because I've been with GoDaddy for many years, and I've only once before had a problem with Support (when Level 1 refused to acknowledge my problem, but it was solved when I managed to get hold of Level 2).

 

This is the first time that Level 2 support has failed me.

 

… at this point I am out of ideas, my apologies.


No need to apologise, Aly. Both you and @PL281 have been helpful in prompting me try out several things that I wouldn't have otherwise thought of, so at least they've been ruled out. I've also seen your screenshots, which confirm that my complaint is valid.

 

Thanks again for your efforts. I'll phone Support today and see if I can get them to let me speak directly to Level 2, because trying to communicate with Level 2 via Level 1 inevitably leads to misunderstandings (the so-called Chinese Whispers effect).

PL281
Super User IV

@PaddyLandau 

 

As @Aly (great screen shots) showed - and I was going to say I was guessing a mismatch between the "server version" and the "account version" 

I believe in cPanel in the selector that it defaults to 5.4 - if you have this set to 7.4 and command line or phpinfo() is showing 5.4 - than there is an issue - but if the selector is on 5.4 just change it to 7.4 and you should be good to go.

I am a GoDaddy End User - Just Like You
Check out my site! | I currently manage over 300 WordPress Websites
* Please note that I offer free advice on this forum. Thank You Info If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community

@PL281 Thanks for your response.

 

I have indeed set cPanel to 7.4, a long time ago, well before I upgraded my account. No change there!

 

The websites run fine; phpinfo() correctly shows PHP version 7.4. (Although phpMyAdmin shows 7.3, which isn't a problem.)

 

Again, PHP 7.4 does run on the server, except when I change directory to public_html.

JesseW
Community Manager

Hi @PaddyLandau. Thanks for taking the time to share your experience. I'm sorry you've had a frustrating time in trying to sort this out. As @Aly and @PL281 have pointed out, there can be a disparity between what the "parent" server is running and what you have in your account. I'm not overly familiar with SSH commands, so I'm not sure what the significance of there being a different version there would be. However, I have been advised that the PHP version you see via SSH is not necessarily reliable due to how SSH users are limited in our environment. A more accurate determination of what's available is the PHP information script you have.

 

If you could explain why the SSH PHP version accuracy is a concern to you, that would help. Are you having trouble running SSH commands that are specific to PHP 7.4?  Are you seeing errors of some sort? 

 

JesseW - GoDaddy | Community Manager | 24/7 support available at x.co/247support | Remember to choose a solution and give likes.

Thanks for joining us, @JesseW 

 

They're not SSH commands. They're actually Linux commands. SSH is the mechanism by which to connect to the Linux server to allow you to run Linux commands. You can do this via cPanel, as @Aly's screenshots show, or via some other app such as PuTTY.

 


 there can be a disparity between what the "parent" server is running and what you have in your account.

Well, the PHP running on my server is the same as what's on my account. Except when I'm in the directory public_html.

 


 I have been advised that the PHP version you see via SSH is not necessarily reliable due to how SSH users are limited in our environment.

That's a bit of red herring, because PHP 7.4 does run on the server (specifically 7.4.16). It's just been bizarrely disabled when, and only when, I enter the folder public_html.

 

Imagine that you have an app on your computer — say, Adobe Reader. When you load Adobe Reader, it's the latest version — except when you load a document from your Documents folder, in which case it's a really old version. That's how bizarre this is.

 


If you could explain why the SSH PHP version accuracy is a concern to you, that would help. Are you having trouble running SSH commands that are specific to PHP 7.4?  Are you seeing errors of some sort? 

As I say, it's not an SSH command but a Linux command, specifically php (the very same command that the website runs when you view a PHP-based website such as WordPress).

To answer your question, yes, I do have errors. I have a script that fixes problems with the database, and it requires PHP version 7.3 or above. It won't work on an older version of PHP, especially one as ancient as PHP version 5.4!

PaddyLandau
Helper II

I've spoken to GoDaddy Support today.

 

They are insisting that, despite the fact that upgrading caused the problem, and other people on this forum have confirmed that they don't have the problem, (a) this isn't a bug, and (b) to fix the bug — you know, the bug that doesn't exist — I must upgrade to a much more expensive package.

 

As one of the websites that I have is a low-level one-man business website, and the few others are all low-level local charities that I host for those charities for free, I can hardly afford to upgrade to an expensive solution.

 

Downgrading would make better sense, because it was upgrading that caused the problem. But I upgraded because GoDaddy's servers are so slow, so that's not a good option.

 

Or, I can just switch host.

 

I have decided to do the latter. I've already found a host that matches my needs, with faster servers to match my needs, and at a cheaper cost.

 

Thank you again for your help. I'll be wishing you all a bittersweet goodbye.

Hi @PaddyLandau ,

 

I don't know if you will pick this up since you have departed GoDaddy but in case you do, upon reflection this has to most likely be a Business Hosting provisioning image error.  The only way to tell for sure would be to RESET the account and see if the PHP version remains the same after a ground zero rebuild.

 

If my own Business Hosting Launch & Enhance accounts show the correct PHP version, as chosen by PHP Selector and your Business Hosting Launch account does not.  The mostly likely logical explanation as to how this happened was an image error when provisioning the account.

 

The second alternative were the upgrade scripts incorrectly specified PHP 5.6 for /public_html/, maybe picking up this value from your previous account or hard coding it via the upgrade script itself.

 

None of this helps but the logic has to be one of these two things.  

 

Anyway, happy travels with your new hosting company.

 

Aly

Thanks, @Aly .

 

I am ⅞ through the process of leaving GoDaddy's hosting. I still have a few domains with them, so I still have an account until I have transferred them as well.

 

I spent even more time with GoDaddy on the phone, and their support is adamant that it's not an error, and that I must fix the error (you, know the error that doesn't exist) by upgrading to a vastly more expensive package. Even though upgrading was what caused the problem.

 

My new host is rather faster than GoDaddy, so there's an advantage there for me.

 

I feel sad about this, because I've been with GoDaddy for many years, but their attitude to this bug stinks — they just want to upsell me, with no guarantee that the upgrade would even fix the bug.

 

Thank you anyway for all of your time and help. I wish you well!