Installing PHP

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
JoHubb
Level 3
Level 3
Posts: 152
Joined: Thu Feb 22, 2018 6:47 am
Location: Ireland

Installing PHP

Post by JoHubb » Mon Apr 22, 2019 4:51 am

I am setting up to be able to open .php files in a browser. I am using the Mint community tutorial on this. I run 18.3 up to date.

Apache2 install was fine.

When I tried to install PHP I got this:

Code: Select all

pestilany@Hansel ~ $  sudo apt-get install php5 libapache2-mod-php5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libapache2-mod-php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'php5' has no installation candidate
E: Package 'libapache2-mod-php5' has no installation candidate
pestilany@Hansel ~ $ 
I'd be grateful for advice.

User avatar
administrollaattori
Level 15
Level 15
Posts: 5881
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: Installing PHP

Post by administrollaattori » Mon Apr 22, 2019 1:17 pm

Mint 18 uses php7.

User avatar
murray
Level 4
Level 4
Posts: 362
Joined: Tue Nov 27, 2018 4:22 pm
Location: Auckland, New Zealand

Re: Installing PHP

Post by murray » Mon Apr 22, 2019 11:45 pm

administrollaattori wrote:
Mon Apr 22, 2019 1:17 pm
Mint 18 uses php7.
I've got PHP 5 and PHP 7 installed on my LM 19.1 machine and a little script that lets me switch between them. I need PHP 5 in order to support some websites that are on old hosting platforms that haven't (and probably never will) update their version of PHP.
Running Mint 19.2 Cinnamon on an Intel NUC8i5BEH with 16GB RAM and 500GB SSD

JoHubb
Level 3
Level 3
Posts: 152
Joined: Thu Feb 22, 2018 6:47 am
Location: Ireland

Re: Installing PHP

Post by JoHubb » Tue Apr 23, 2019 3:44 am

Thanks. I think php7.0 is installed now.

How to check, please. All of the many test methods listed in the Community Tutorial produced errors. Seems that tutorial is badly out of date.

User avatar
murray
Level 4
Level 4
Posts: 362
Joined: Tue Nov 27, 2018 4:22 pm
Location: Auckland, New Zealand

Re: Installing PHP

Post by murray » Wed Apr 24, 2019 12:12 am

JoHubb wrote:
Tue Apr 23, 2019 3:44 am
Thanks. I think php7.0 is installed now.

How to check, please. All of the many test methods listed in the Community Tutorial produced errors. Seems that tutorial is badly out of date.
Create a web page called phpinfo.php in wherever your web server stores its websites and inside it put:

Code: Select all

<?php
phpinfo();
?>
Then in your browser go to localhost/phpinfo.php and you should see a how PHp is configured on your system. Right at the top of the output it should say "PHP Version <whatever>".
Running Mint 19.2 Cinnamon on an Intel NUC8i5BEH with 16GB RAM and 500GB SSD

deepakdeshp
Level 15
Level 15
Posts: 5886
Joined: Sun Aug 09, 2015 10:00 am

Re: Installing PHP

Post by deepakdeshp » Wed Apr 24, 2019 1:34 am

murray wrote:
Wed Apr 24, 2019 12:12 am
JoHubb wrote:
Tue Apr 23, 2019 3:44 am
Thanks. I think php7.0 is installed now.

How to check, please. All of the many test methods listed in the Community Tutorial produced errors. Seems that tutorial is badly out of date.
Create a web page called phpinfo.php in wherever your web server stores its websites and inside it put:

Code: Select all

<?php
phpinfo();
?>
Then in your browser go to localhost/phpinfo.php and you should see a how PHp is configured on your system. Right at the top of the output it should say "PHP Version <whatever>".
The default is /var/www/html
If I have helped you solve a problem, please add [SOLVED] to your first post title, it helps other users looking for help, and keeps the forum clean.
Regards,
Deepak

I am using Mint 19.2 Cinnamon 64 bit with AMD A8/7410 processor . Memory 8GB

JoHubb
Level 3
Level 3
Posts: 152
Joined: Thu Feb 22, 2018 6:47 am
Location: Ireland

Re: Installing PHP

Post by JoHubb » Wed Apr 24, 2019 5:14 am

Thanks guys.

Apparently I do not have 'write' access to var/www/html

What to do?

deepakdeshp
Level 15
Level 15
Posts: 5886
Joined: Sun Aug 09, 2015 10:00 am

Re: Installing PHP

Post by deepakdeshp » Wed Apr 24, 2019 11:43 am

Run editor with sudo command like sido editor. Password is your user password.
If I have helped you solve a problem, please add [SOLVED] to your first post title, it helps other users looking for help, and keeps the forum clean.
Regards,
Deepak

I am using Mint 19.2 Cinnamon 64 bit with AMD A8/7410 processor . Memory 8GB

JoHubb
Level 3
Level 3
Posts: 152
Joined: Thu Feb 22, 2018 6:47 am
Location: Ireland

Re: Installing PHP

Post by JoHubb » Thu Apr 25, 2019 2:21 am

deepakdeshp wrote:
Wed Apr 24, 2019 11:43 am
Run editor with sudo command like sido editor. Password is your user password.

Hmm...

I used Kate to write this:

Code: Select all

<?php
phpinfo();
?>
When I tried to save this as an .html file in var/www/html I don't have write access.

Should I be using a different editor?

deepakdeshp
Level 15
Level 15
Posts: 5886
Joined: Sun Aug 09, 2015 10:00 am

Re: Installing PHP

Post by deepakdeshp » Thu Apr 25, 2019 5:09 am

You dont have write access on that .
Use

Code: Select all

sudo kate file
to edit the file.

https://www.tutorialspoint.com/unix/uni ... ission.htm
If I have helped you solve a problem, please add [SOLVED] to your first post title, it helps other users looking for help, and keeps the forum clean.
Regards,
Deepak

I am using Mint 19.2 Cinnamon 64 bit with AMD A8/7410 processor . Memory 8GB

User avatar
murray
Level 4
Level 4
Posts: 362
Joined: Tue Nov 27, 2018 4:22 pm
Location: Auckland, New Zealand

Re: Installing PHP

Post by murray » Thu Apr 25, 2019 6:59 pm

JoHubb wrote:
Thu Apr 25, 2019 2:21 am
I used Kate to write this:

Code: Select all

<?php
phpinfo();
?>
When I tried to save this as an .html file in var/www/html I don't have write access.
Don't save it as a .html file! Since you're using PHP, it should be saved as a .php file. Also follow deepakdeshp's advice.
Running Mint 19.2 Cinnamon on an Intel NUC8i5BEH with 16GB RAM and 500GB SSD

Post Reply

Return to “Software & Applications”