This is a static archive of the old Zorin Forum.

The information below may be outdated. Visit the new Zorin Forum here ›

If you have registered on the old forum, you will need to create an account on the new forum.

[SOLVED] Help with Webserver OpenCart php file install

ozstar

Thu Dec 12, 2019 1:30:10 am

Hi,

I have installed OpenCart hundreds of times on shared servers but not sure what needs to be set up in Linux to make it all work.

I have downloaded the install and have it in htdocs but when I connect to the install index.php I get nada, zip, nuttin'.

I have phpMyAdmin, mySQL set up and running but guess there is more to it so that it 'reads' the php files.

Any direction help please?

oz

Aravisian

Thu Dec 12, 2019 1:47:57 am

Could you please try installing by following each command below pasted into your terminal one at a time?
Code:
sudo apt-get install apache2

Code:
sudo apt-get install php libapache2-mod-php

Code:
sudo apt-get install php-cli php-common php-mbstring php-gd php-intl php-xml php-mysql php-zip
php-curl php-xmlrpc

Code:
sudo systemctl restart apache2

Code:
cd /tmp

Code:
wget https://github.com/opencart/opencart/releases/download/3.0.2.0/3.0.2.0-OpenCart.zip

Code:
sudo apt-get install unzip

Code:
unzip 3.0.2.0-opencart.zip

Code:
sudo mv upload/ /var/www/html/opencart

Code:
sudo cp /var/www/html/opencart/config-dist.php /var/www/html/opencart/config.php

Code:
sudo cp /var/www/html/opencart/admin/config-dist.php /var/www/html/opencart/admin/config.php

Code:
sudo chmod -R 755 /var/www/html/opencart/

Code:
sudo a2enmod rewrite

Again:
Code:
sudo systemctl restart apache2


Open your browser and navigate to <Your IP Address>/opencart to view setup.

ozstar

Thu Dec 12, 2019 2:46:44 am

Many thanks.... Wo.. no wonder i had no hope :-)

I got to unzip 3.0 etc opencart and this is the terminal result of the following lines..

Code:
HTTP request sent, awaiting response... 200 OK
Length: 16544198 (16M) [application/octet-stream]
Saving to: '3.0.2.0-OpenCart.zip’

3.0.2.0-OpenCart.zi 100%[===================>]  15.78M  4.94MB/s    in 3.2s   

2019-12-12 13:33:37 (4.94 MB/s) - '3.0.2.0-OpenCart.zip’ saved [16544198/16544198]

david@david-HP-Compaq-6000-Pro-MT-PC:/tmp$ sudo apt-get install unzip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
unzip is already the newest version (6.0-21ubuntu1).
unzip set to manually installed.
The following packages were automatically installed and are no longer required:
  libabw-0.1-1 libcdr-0.1-1 libcmis-0.5-5v5 libe-book-0.1-1 libeot0
  libepubgen-0.1-1 libfreehand-0.1-1 libllvm7 libmspub-0.1-1 libmwaw-0.3-3
  libodfgen-0.1-1 libpagemaker-0.0-0 libreoffice-avmedia-backend-gstreamer
  libreoffice-pdfimport librevenge-0.0-0 libvisio-0.1-1 libwpd-0.10-10
  libwpg-0.3-3
Use 'sudo apt autoremove' to remove them.
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
david@david-HP-Compaq-6000-Pro-MT-PC:/tmp$ unzip 3.0.2.0-opencart.zip
unzip:  cannot find or open 3.0.2.0-opencart.zip, 3.0.2.0-opencart.zip.zip or 3.0.2.0-opencart.zip.ZIP.
david@david-HP-Compaq-6000-Pro-MT-PC:/tmp$ sudo mv upload/ /var/www/html/opencart
mv: cannot stat 'upload/': No such file or directory
david@david-HP-Compaq-6000-Pro-MT-PC:/tmp$ sudo cp /var/www/html/opencart/config-dist.php /var/www/html/opencart/config.php
cp: cannot stat '/var/www/html/opencart/config-dist.php': No such file or directory
david@david-HP-Compaq-6000-Pro-MT-PC:/tmp$


Not sure what to do here..

Really appreciate your help, thanks.

Aravisian

Thu Dec 12, 2019 4:00:30 am

I am sorry...the Unzip command should be:
Code:
unzip 3.0.2.0-OpenCart.zip

I did not anticipate that the downloaded file name would have capitalized letters. The above command will work.
You may have trouble with the mv command, as well. Because I just tried it and it gave me the same error it gave you, even with the file unzipped.
So, what I would suggest is that you open your File manager as root:
Code:
pkexec thunar

and then navigate to your top level file system. Go to the var folder. Open that and if you have the www folder, great - if not, create it. Same goes for html folder and opencart folder. Then move ll of the files you unzipped into it with drag and drop using your Thunar File manager with Elevated to Root privileges.
Then start again at this point:
Code:
sudo cp /var/www/html/opencart/config-dist.php /var/www/html/opencart/config.php

Code:
sudo cp /var/www/html/opencart/admin/config-dist.php /var/www/html/opencart/admin/config.php

Code:
sudo chmod -R 755 /var/www/html/opencart/
and continue the rest of the way.

ozstar

Thu Dec 12, 2019 6:03:38 am

Not sure if I got it correctly, but I did this...

I unzipped 3.0.2.0-OpenCart.zip into /tmp/.
I created with Thunar a /html/ folder in /www/ then the folder opencart in folder html. Was that correct or were they both sub folders of www ?

Not sure about this part.. Do I drag the unzipped opencart files from /tmp/ to what folder, the www, html or opencart?
They were the only upzipped files I recall. Were there more?

Anyway once I get that folder stuff right then I will do the other commands.

If I need correction on the flow, just let me know.

Sorry to mess with your time.

Swarfendor437

Thu Dec 12, 2019 8:20:46 am

Hi ozstar you need to slow down a bit. Take care to read Aravisian's post slowly in particular where he mentioned creating files in /var. ;) :D

ozstar

Thu Dec 12, 2019 9:15:53 am

Hi,

Yes I know where you're coming from however remember I am a newby and not sure what folders go where and in what order.
All the rest made sense but wanted to make sure I was placing the files in the correct place otherwise I would be in a real mess and not sure how to get out of it.
These were my questions.
.
Go to the var folder. Open that and if you have the www folder, great - if not, create it.[/quote}
It was there okay.
Same goes for html folder and opencart folder.

Meaning create those 2 folders in the www folder ?
Then move ll of the files you unzipped into it with drag and drop using your Thunar File manager with Elevated to Root privileges
.
Grab the unzipped files into the www folder or one of the others?

I know in the world of 'give' and' take', us newby's are all 'take', however we have no option if we are to learn new stuff.

It's guys like you and Aravisian who are good enough to share your time and knowledge, that we unfortunately have to lean on during our learning process and as a very busy administrator myself, I know the cost of time.
I
am really grateful for what is so freely given and try to overtly convey my thanks for every snippet of info. :)

It's all good, and I am enjoying the challenge Linux is throwing up to a Windows pro. :D

Hopefully the time will come to 'give' back to others who will be lost like we are now.

oz

Swarfendor437

Thu Dec 12, 2019 1:01:27 pm

Hi I responded on my smart phone and at work now - will post a simple 'go to' of images on how to graphically get and terminally get to /var. ;) :D

Wonder if this step-by-step will make life easier for you:

https://linuxize.com/post/how-to-instal ... ntu-18-04/

Aravisian

Thu Dec 12, 2019 2:20:11 pm

ozstar wrote:Not sure if I got it correctly, but I did this...

I unzipped 3.0.2.0-OpenCart.zip into /tmp/.
I created with Thunar a /html/ folder in /www/ then the folder opencart in folder html. Was that correct or were they both sub folders of www ?

Not sure about this part.. Do I drag the unzipped opencart files from /tmp/ to what folder, the www, html or opencart?
They were the only upzipped files I recall. Were there more?

Anyway once I get that folder stuff right then I will do the other commands.

If I need correction on the flow, just let me know.

Sorry to mess with your time.
In this case, you have started out with a particularly complex installation. It's not as easy as downloading it from software channel and letting it do all the work. Good Training!
In Linux, folder directory paths are linear. In this case, we are looking at a linear path starting with the folder labeled as "var."
Following the path, we have var/www/html/opencart
The linear path shows "var" folder which contains subfolder "www." Contained within "www" is a folder named "html." Contained within "html" is a folder named "opencart."
Now, let's say that you make a directory that is in folder /etc named "example. That path is /etc/example. Let's say you make another named "example2" that also is in /etc. That path is /etc/example2. It does not mention the folder named 'example" or any other folders that cohabit the /etc folder in its path because they are not directly referenced. The path never moves sideways. It is always linear, starting at the top and moving downward until you reach the referenced file.
Let's say that you have a path /var/www/html/subfolder1/example.txt.
Let's say you open your GUI Thunar and navigate that path and you see that in subfolder1 is also subfolder2. Opening that, you see also "example.txt."
This was not referenced by your path, it is another 'exampl.txt' and you can ignore it. Stick To Your Path. Do not deviate or stop sooner than it tells you to or go further than it tells you to.
Lastly, there is something that CAN confuse on paths: Assumed Path. Let's say that someone tells you to download an image and place it in your ~/Pictures folder. As you can see, that path doesn't look like it makes sense. In this case, the author of the instructions assumes you know the heading of the path without being told. And chances are that by the time you see one, you will know it. In this case, "~" symbol means /home folder. So you already know that the path must be /home/<Your user name folder, we will call it ozstar>/Pictures folder.

So each path is linear and it does not reference other directories that share space within a folder with it. Those directories would have their own path, even if that path is entirely the same until you reach that individual object.
I hope this makes sense. As you can see, this is MUCH more organized and direct than how some OS's do things.
In the guide that Swarfendor posted a link to, we see a command to follow. I will use that as an example, now
Code:
mkdir -p /var/www/html/example.com

The 'mkdir" means "make directory." This is exactly the same as if you open the file manager in a GUI, you navigate the path to /var/www/html/, right click and select "Create Folder" and then name the folder "example.com"
The "-p" tells the computer that it is instructed to create a path. Rather than creating the directories in stages each folder along with way with multiple commands, the -p allows you to create the directory with one command as a path to the final directory.
Nexxt, the command shows the path to create. Using the -p command, with see that /var already exists. Let's assume /html in the path does not and neither does 'example.com". Then the mkdir command will follow the linear path until it references a directory that does not yet exist and create it and ignore directories in the path that already exist and not create a new one.
The next command shows
Code:
sudo cp /var/www/html/example.com/{config-dist.php,config.php}

The command 'sudo' is SuperUser Do as in, Superuser Do this task. Sudo means you must use your password to grant Root or Admin privileges.
the 'cp' command means copy.
This can also be done using your GUI of your file manager. Right click and select copy on your original file, navigate to the new directory, right click and select paste.
In these terminal commands, you have much more speed but also much more power. Both the 'mv' and the 'cp' commands (move and copy, respectively) can do more than just move or copy. They also can alter your file if you wish. In this command, you can see that is the case: You are copying the file config-dist.php to the new directory AND renaming it at the same time, to config.php. You can see the advantage of efficiency.

Now, I am going to get ahead of us for a moment and address something new in the guide Swarf linked to that we did not discuss before.
Code:
sudo nano /etc/nginx/sites-available/example.com

This one can get confusing. What Nano is, is using your text editor in the terminal.
But just as with all the examples above, you can do this using your GUI just as well. It May be easier for you to use the GUI for now, as it is much more familiar with the SAVE button and the Close Button because doing that in terminal the first time is a bit frustrating. Remembering to hold shift when past or copying in terminal when you do not hold shift at any other time and various other things can make it confusing.
In the above command, we navigate in our Elevated file manager to /etc/nginx/sites-available/ directory. We locate the file called "example.com" and open it with Gedit or Mousepad or whatever GUI text editor you are using.
Then make your changes in the familiar way.

So, while commands for the terminal can be fast and powerful, do not fear to deviate from the command line and use a more familiar method as you explore your system and learn how it is structured and organized. You will get the same result (Unless warned ahead of time that it is rare case exception) and you will feel less 'newby' and more in control. It may seem daunting at first, but once you get the hang of it... Like learning to ride a bike or how to drive a Manual car after learning how to drive with an Automatic, you find yourself never wanting to go back to being controlled by the machine, again.

And neverever feel ashamed to ask. Time passes but you are not taking anyones time. As far as being a Newby goes- don't worry about it. So am I.

ozstar

Thu Dec 12, 2019 10:26:27 pm

Have to run so haven't read this yet, except the last line.

You are too gracious.

Thanks, will get to it later today.

ozstar

Thu Jan 02, 2020 3:46:42 am

Well finally back.. it's been a busy time !

For a start Happy New Year !

I will have to read through this again to see where I'm up to, then resume.
Here goes,
So over the next week or so will hopefully will get it done..

oz

ozstar

Thu Jan 02, 2020 4:27:29 am

Okay so started Apache 2 in terminal and I see the Apache2 Ubuntu Default Page in browser 'local host' so I guess so far so good.

I see that index.html in dir var/www/html/ as well as the opencart folder.

When I give this URL http://localhost/opencart/ I get a file list inside that dir.
indexofopencart.png


I guess I need to open up the zip to get to the upload directory which has the actual OC php files. Will see what happens there anyway.

Ah haaa.. See the Upload dir there in the File GUI with an Red X on it so guess I am not in Admin mode, so back we go..

ozstar

Thu Jan 02, 2020 6:40:59 am

Well checked I had Apache..
[sudo] password for david:
Available applications:
Apache
Apache Full
Apache Secure
CUPS
Samba

I noticed on one of the web tutorials that they also had OpenSSH in their list but I did not.
Samba because I want to be able to connect to my Win10 LAN. Not sure what CUPS is.

Profile: Apache Full
Title: Web Server (HTTP,HTTPS)
Description: Apache v2 is the next generation of the omnipresent Apache web
server.

Ports:
80,443/tcp
Code:
I followed the instructions to add my static IP address..

sudo nano /etc/apache2/apache2.conf

add a ServerName directive, pointing to your primary public IP address:

/etc/apache2/apache2.conf
ServerName server_domain_or_IP

Next, check for syntax errors by typing:

sudo apache2ctl configtest

Output
Syntax OK


So to this point all good except when I put the IP address in the browser I got the Admin Login Panel for the router/modem.

Aravisian

Thu Jan 02, 2020 7:06:58 am

ozstar wrote:Not sure what CUPS is.

Printer server.

ozstar

Thu Jan 02, 2020 9:31:49 am

Doh, of course PS..

Thanks

ozstar

Fri Jan 03, 2020 12:37:10 am

Hi,
I am still not able to get past the router login panel when I place the IP in the browser.
It says it cannot use 80 so I have used 8080 in Pt Forwarding. This is also used by other devices on other local LAN IPs.
I have gone into ports.conf but not sure where to change. It also says check 000-default.conf.

Not sure where to go here now.

Code:
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80     
[b]Do I just add Listen 8080 here?[/b]

<IfModule ssl_module>
   Listen 443
</IfModule>

<IfModule mod_gnutls.c>
   Listen 443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


I see this in 000-default.conf do I ned to chnage that too.

Code:
<VirtualHost *:80>
   # The ServerName directive sets the request scheme, hostname and port that
   # the server uses to identify itself. This is used when creating

Aravisian

Fri Jan 03, 2020 2:44:54 am

Do I just add Listen 8080 here?
That is what I would try.

ozstar

Fri Jan 03, 2020 8:51:03 am

Thank you.

I did that but it still didn't work so after googling, someone on a network forum suggested I change the Router to 8081 from 80 and make 80 for the server I am trying to get going.

I changed ports.conf and 000-default.conf back to 80 which was the default and placed 80 in the Router Port Forwarding however I still get the Router login panel when I put the IP# in the browser.

When I put localhost as the URL I get this now..
Firefox can’t establish a connection to the server at localhost.

I have placed ServerName 202.***.***.*** at the bottom of the apache2.conf file.

Code:
# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

ServerName 202.***.***.***


Any direction please ?

I have been using this as my tutor.
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04

Aravisian

Fri Jan 03, 2020 9:45:55 am

ozstar wrote:I have been using this as my tutor.

You could probably tutor me in this topic. I will do some web searching later, but I would encourage you to do the same. Maybe two heads will be better than one.

Swarfendor437

Fri Jan 03, 2020 7:53:41 pm

OK, that web page could be the issue as it specifically states the tutorial is for Ubuntu 16.04 = Zorin 12.x and I see from your sig that you are running Zorin 15 which is based on ubuntu 18.04 so perhaps searching for a guide for that basis might prove fruitful ... we can but hope! ;) :D

ozstar

Fri Jan 03, 2020 9:45:22 pm

Okay, got my magnifying glass and Watson with me.. Surely we'll turn something up more relevant. !

EDIT: Found this..
https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-ubuntu-18-04-quickstart

I checked it all again and this is the result..

Code:
david@david-HP-Compaq-6000-Pro-MT-PC:~$ sudo ufw app list
Available applications:
  Apache
  Apache Full
  Apache Secure
  CUPS
  Samba
david@david-HP-Compaq-6000-Pro-MT-PC:~$ sudo ufw allow 'Apache'
Rules updated
Rules updated (v6)
david@david-HP-Compaq-6000-Pro-MT-PC:~$ sudo ufw status
Status: inactive   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
david@david-HP-Compaq-6000-Pro-MT-PC:~$ sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset:
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Fri 2020-01-03 15:42:14 AEDT; 17h ago
  Process: 7662 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS
  Process: 10981 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/
  Process: 7668 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCE
Main PID: 7672 (apache2)
    Tasks: 8 (limit: 4524)
   CGroup: /system.slice/apache2.service
           ├─ 7672 /usr/sbin/apache2 -k start
           ├─10986 /usr/sbin/apache2 -k start
           ├─10987 /usr/sbin/apache2 -k start
           ├─10988 /usr/sbin/apache2 -k start
           ├─10989 /usr/sbin/apache2 -k start
           ├─10990 /usr/sbin/apache2 -k start
           ├─11410 /usr/sbin/apache2 -k start
           └─14514 /usr/sbin/apache2 -k start

Jan 03 15:42:14 david-HP-Compaq-6000-Pro-MT-PC systemd[1]: Starting The Apache H
Jan 03 15:42:14 david-HP-Compaq-6000-Pro-MT-PC systemd[1]: Started The Apache HT
Jan 04 00:06:54 david-HP-Compaq-6000-Pro-MT-PC systemd[1]: Reloading The Apache
Jan 04 00:06:54 david-HP-Compaq-6000-Pro-MT-PC systemd[1]: Reloaded The Apache H
lines 2-24


The only thing different to the tutor is that the ufw is active and returns this, where my returns as inactve.

Code:
$   sudo ufw status     <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Output
Status: active

To                             Action             From
--                                 ------                ----
OpenSSH                 ALLOW       Anywhere                 
Apache                     ALLOW       Anywhere                 
OpenSSH (v6)          ALLOW       Anywhere (v6)             
Apache (v6)             ALLOW       Anywhere (v6)


So not sure why I can't change this.

ozstar

Fri Jan 03, 2020 10:29:25 pm

Found it.. But not sure it is saying the right things, or being too open.

Code:
sudo ufw enable  <<<<<<<<<<<<<<<<<
Status: active   <<<<<<<<<<<<<<<<<<

To                         Action      From
--                         ------      ----
Apache Full                ALLOW       Anywhere                 
80/tcp                     ALLOW       Anywhere                 
Apache                     ALLOW       Anywhere                 
Apache Full (v6)           ALLOW       Anywhere (v6)             
80/tcp (v6)                ALLOW       Anywhere (v6)             
Apache (v6)                ALLOW       Anywhere (v6)


Unfortunately I still cannot get through that Router login panel to the server.

Aravisian

Sat Jan 04, 2020 6:14:53 am

I wonder if firewall is still inhibiting.
Code:
sudo ufw enable

Code:
sudo ufw allow 'Apache'

Code:
sudo ufw status

ozstar

Sat Jan 04, 2020 9:41:33 pm

Thank you Aravision.

Did that and all is good there.

I have however found out a couple of things..

One can check to see whether traffic is coming into the server through the router on port 80 with the..

Code:
sudo tcpdump port 80 command


and so importantly...

Some Routers (my Netcomm NF17) will not allow you to access a local webserver using an outside IP# (256.***.***.***) whilst it will, using the LAN IP# (192.xx.xx.xx)

I have been trying to test whether my webserver setup actually works with the outside IP and spent days trying to do this using PCs inside the LAN.

I should have remembered as I had this same trouble years ago setting up a CCTV however it took some help from a network forum to remind me.

I turned my phone WIFI 'off' and put the IP# into the phone browser and there it was ! the Apache page on the server ! Bingo !

So it does work!

Swarfendor437

Sun Jan 05, 2020 5:55:56 pm

Yay! ;) :D