ផ្នែកទី 2: បង្កើតគេហទំព័រ eCommerce ដោយប្រើ PrestaShop Framework

Build an ecommerce site using PrestaShop framework

សួស្តីលោក លោកស្រី អ្នកនាងកញ្ញា 1Byte ត្រលប់មកវិញហើយ។. As always, to be able to build a website using a certain framework. You need to do the following steps:

  • ជំហាន 1: ដំឡើងក្របខ័ណ្ឌ PrestaShop កញ្ចប់ចាំបាច់ និងរៀបចំការប្ដូរតាមបំណងនៅផ្នែក BackEnd ទៅម៉ាស៊ីនមេ (អ្នកបានធ្វើវានៅក្នុង ជាផ្នែកមួយ 1)
  • ជំហាន 2: ដោយផ្អែកលើសមាសធាតុនៅក្នុងជំហានទី 1 សូមដំឡើងគេហទំព័រ PrestaShop តាមរយៈកម្មវិធីរុករករបស់អ្នក។ (You are here, Part 2!)
  • ជំហាន 3: ដំឡើងវិញ្ញាបនបត្រ SSL នៅលើគេហទំព័ររបស់អ្នក។
  • ជំហាន 4: ប្ដូរចំណុចប្រទាក់តាមបំណង និងគ្រប់គ្រង PrestaShop តាមការចូលចិត្តរបស់អ្នក ^^

តម្រូវការជាមុន

ដើម្បីធ្វើជំហានទី 2 នេះអ្នកត្រូវអានឱ្យចប់ ជាផ្នែកមួយ 1. នេះជាកត្តាចាំបាច់ ហើយអ្នកត្រូវតែមានសមាសធាតុដូចខាងក្រោមៈ

  • ឈ្មោះដែន
  • Cloud Server
  • PrestaShop framework is already installed on your Server
  • A spirit of eagerness to learn new things

No More Small Talk, Let’s Hands On

In ជាផ្នែកមួយ 1អ្នកនឹងឈប់នៅទីនេះ

(បន្ទាប់ពីជ្រើសរើសភាសារបស់អ្នក សូមចុច Next)
(To use PrestaShop framework, you need to agree to some terms and conditions. Check on the box and click Next)
(Ooopps…! Warning alert = =!)

តែកុំបារម្ភពេកព្រោះ 1Byte is already here, I am always with you when you are in trouble

យោងតាមការណែនាំរបស់ PrestaShop មានចំណុចមួយចំនួនដែលអ្នកត្រូវជួសជុល។

→ ចូរយើងត្រលប់ទៅផ្នែក Server ហើយប្រើ Terminal Interface ដើម្បីជួសជុលវា។

(I already ssh into the server, how about you?)

1) ដំឡើងផ្នែកបន្ថែម PHP "Mbstring" ដោយដំណើរការពាក្យបញ្ជានេះ។

sudo yum install php-mbstring -y

sudo systemctl restart httpd

2) បន្ទាប់គឺដំឡើង "PHP Accelerator" ដើម្បីបង្កើនគេហទំព័ររបស់អ្នក។

តែចាំមើល!!!…

I also read the document of PHP accelerator and this only works with PHP versions 4 and 5. While our PHP is version 7

→ Will skip this step. You see, I save you time again

(For more information, you can access to សម្ភារៈបង្កើនល្បឿន PHP)

យល់ព្រមឥឡូវនេះ យើងគ្រាន់តែត្រូវការធ្វើឱ្យទំព័ររបស់យើងឡើងវិញ ដើម្បីពិនិត្យមើលថាតើទំព័រ សារព្រមាន នៅសល់ឬអត់? 

(Bravo! យើងលែងឃើញសារព្រមានទៀតហើយ ផ្ទុយទៅវិញ PrestaShop តម្រូវឱ្យយើងផ្តល់ព័ត៌មានមួយចំនួនដើម្បីរៀបចំគេហទំព័ររបស់អ្នក។ នៅពេលដែលអ្នកបានបញ្ចប់ហើយ គ្រាន់តែចុច Next ដើម្បីបន្ត) 

ចំណាំសំខាន់ 1:

  • Please remember not to check Enable SSL with option ចាស
  • Please check with options ទេ
  • This is because If you choose the បាទជម្រើសវានឹងធ្វើឱ្យគេហទំព័ររបស់អ្នកមិនអាចដំណើរការបានដោយហេតុផលពីរយ៉ាង៖

1) នៅខាង server យើងមិនបានប្រាប់ firewallcmd អនុញ្ញាតសេវា https នៅឡើយទេ, យើងគ្រាន់តែ allowed http service

2) រហូតមកដល់ពេលនេះ គេហទំព័ររបស់យើងមិនទាន់បានដំឡើងវិញ្ញាបនបត្រ SSL ទេ។  

ចំណាំសំខាន់ 2:

PrestaShop requests database information (which I already created in ជាផ្នែកមួយ 1) in this phase.

(This image was retrieved from Part 1 at the section create MariaDB database. If you don’t remember, please refer to Part 1 my friend)

នៅពេលដែលអ្វីៗគ្រប់យ៉ាងរួចរាល់ សូមផ្លាស់ទីទៅផ្នែកបន្ទាប់

After provding the info to PrestaShop, check the connection to your database

  • If everything goes well, a message like the one above will be shown.
  • Then just click on Next button
  • If PrestaShop cannot connect to the database, you need to check the information such as db_name, db_user និង db_pass ដែលត្រូវបានបង្កើតឡើងនៅ ជាផ្នែកមួយ 1

(And now you just enjoy a cup of tea while the system automatically installs for you)

ប្រសិនបើអ្នកឃើញរូបភាពនេះដូចខ្ញុំ សូមអបអរសាទរ អ្នកបានដំឡើងក្របខ័ណ្ឌ PrestaShop ដោយជោគជ័យដោយប្រើកម្មវិធីរុករករបស់អ្នក

(PrestaShop encourages us to delete “install” folder – which highlighing in box 2)

ចំណាំ:

  • The info of box (1) will be your credential to login in Admin Dashboard
  • Ok la, let’s back to our terminal and do the following commands
#Navigate to prestashop directory and list all files
cd /var/www/html/prestashop/
ls
(ថត​ដែល​ខ្ញុំ​បាន​រំលេច​គឺ​ថត "ដំឡើង"។ គ្រាន់​តែ​លុប​វា​ចេញ​សម្រាប់​ការ​អនុវត្ត​ល្អ​បំផុត)

ហេតុ​អ្វី​បាន​ជា​ខ្ញុំ​រំលេច​បញ្ជី​ឈ្មោះ "admin" ទាំង​មូល? I’ll leave it open for now, but in a bit, I’ll explain it to you below

#Remove the install directory
rm -rfv install/

ចំណាំសំខាន់:

  • Once the directory named “ដំឡើង"ត្រូវបានលុបទាំងស្រុង ប្រព័ន្ធនឹងប្តូរឈ្មោះថតដោយស្វ័យប្រវត្តិ"គ្រប់គ្រង"ទៅ"រដ្ឋបាលxxx"
  • Why is that? because PrestaShop doesn’t want bad guys (hackers) to know the path to the admin dashboard page. Therefore, to prevent curious people from coming to the admin page, PrestaShop will rename this “គ្រប់គ្រង"ថតឯកសារទៅ"រដ្ឋបាលxxx"

To verify this, use this command again

#Verify the directory named "admin"
ls

ដូចដែលអ្នកអាចឃើញថត "គ្រប់គ្រង"ត្រូវបានប្តូរឈ្មោះទៅជា"អ្នកគ្រប់គ្រង 233ymehbz"

This name will be completely different from yours.

So please check it:

→ ខ្ញុំបានជួយអ្នកឱ្យទទួលបានចម្លើយចំពោះសំណួរខាងលើរួចហើយ

→ To connect to your admin dashboard you have to type in your URL as follow: http://<your-server-ip>/admin233ymehbz

(As you can see, I have access to login-page admin)

ប៉ុន្តែ​បើ​មាន​ឈ្មោះ​បែប​នេះ​ពិបាក​ចាំ​មែន​ទេ?

ដូច្នេះហើយ យើងច្រើនតែប្តូរឈ្មោះថតនេះ "រដ្ឋបាលxxx" ជា​ឈ្មោះ​ដែល​ងាយ​ចាំ ប៉ុន្តែ​ពិបាក​ទាយ

#Rename "adminxxx" directory to a new name
mv admin233ymehbz/ secret_page/
ls
(In here, I change to “secret_page”. You can change it to the name you like, easy to remember)

Let’s test again by navigating to http://<your-ip-server>/secret_page 

(voilà, everything is going as expected) 

សង្ខេប

រហូតមកដល់បច្ចុប្បន្ន៖

  • You have successfully installed the PrestaShop framework on both Server and Browsers
  • Your customers can connect to the homepage (FrontEnd)
  • You can connect to the admin page

However, there is still an important factor that has not been implemented yet is to be able to install the វិញ្ញាបនបត្រ SSL on your site. Because the article is too long, I will guide you to install SSL Certificate in ជាផ្នែកមួយ 3 សូមមើល YAAAA!