Steps for building and running ECShop_V2.7.3 in Linux environment

   A product colleague in the company recently gave me something, saying that I should put it on Linux and run it... At first I thought it was just a simple static page and it would be done with nginx, but I didn't expect to open it and take a look It's full of .php files. I thought that this guy really doesn't understand technology at all. It feels more complicated than I expected. Besides, I just heard about php before and I haven't touched it at all... But I can't do it for the company. Save money and try to build and play if you want to challenge yourself with new things. After consulting a lot of information, I basically understood how to do it, and it took one afternoon and two hours to get it done perfectly, during which I encountered a lot of pits. After solving one by one, the sense of accomplishment is what a programmer feels like. I think as a peer Should be able to feel it. It was not too early to go home last night. I just took a nap and thought about it. I recorded and shared the most correct and concise steps. I hope that friends in need can benefit from it... Okay, no nonsense, let's start Step-by-step introduction to the construction and operation steps (I will mark the key steps and points that need attention in red).

 

  The environment and software version I used for this build are: CentOS release 6.3 (Final) + httpd-2.2.31 + PHP 5.4.45 + mysql 5.5.53

 

1. Upload httpd-2.2.31.tar.gz from the local to the Linux server through ftp, and install apache through the following steps

  

1) Unzip httpd-2.2.31.tar.gz
	tar -zxf httpd-2.2.31.tar.gz
2) Switch to httpd-2.2.31 directory
	cd httpd-2.2.31
3) Compile (install apache to /usr/local/apache2 directory)
	./configure --prefix=/usr/local/apache2
4) Install
	make
	make install
5) Go to the apache installation directory and edit the configuration file httpd.conf with vi
	cd /usr/local/apache2/conf
	vi httpd.conf
	Search for ServerName, uncomment it and edit www.example.com to localhost
6) Save and exit, switch to the bin directory, and start the http service
	cd ../bin/
	./apachectl start
7) Open the browser and enter the ip address to access, it works!, so far the apache installation is complete;

  

2. Install the PHP service through the following command (because our server is paid for, so it comes with yum, it is recommended to use yum if you can, so it will automatically install the required dependencies)

 

yum -y install php php-fpm --enablerepo=remi 

 

After the installation is complete, you can use the php -v command to view the installed php version

 

Notice:

1) --enablerepo=remi is very important. I understand that it will automatically match the version required by the dependent package and update the existing version instead of reporting conflict errors directly. This is tried and tested);

2) The installation of php-fpm is also necessary. If you modify the php.ini configuration file, you need to restart php-fpm to take effect;

 

3. To install the mysql service, it should be noted that you need to clear all mysql related stuff before installation. For specific steps, please refer to my other blog " Mysql 5.7 installation and remote connection configuration under Linux "

  

yum -y install mysql-server mysql mysql-devel --enablerepo=remi (msyql-server is easy to be dropped here)
The following are some common operations of the yum command (for reference charging only):
	
yum list installed | grep mysql (view installed mysql)

yum -y remove mysql-libs.x86_64 (Uninstall an existing software according to the result of viewing)

yum list | grep mysql or yum -y list mysql* (to view a list of some specified software in the yum library)

 

4. Now the required software has been installed, but at present, apache, php, and mysql are independent of each other. First, apache as an application server must enable php support to run php projects. Then you need to edit the apache configuration file httpd.conf. The specific changes are as follows:

 

1) Add the php module ( this is the most critical )

    LoadModule php5_module        /usr/lib64/httpd/modules/libphp5.so

 

2) Add index.php to dir_module,

    <IfModule dir_module>

        DirectoryIndex index.html index.php

    </IfModule>

 

3) Add php type in mime_module

    AddType application/x-httpd-php .php

    AddType application/x-httpd-php-source .phps

 

4) Write a test php file to verify whether php support is enabled successfully. According to the instructions of the DocumentRoot configuration item, create a new info.php file with vi under "/usr/local/apache2/htdocs" and edit the content as follows:

<?php
    phpinfo();
?>

 

5) Restart the httpd service, enter http://ip/info.php in the browser, if it appears as shown in the figure below, it means that the php support is successfully enabled, and the association between apache and php is ok

  

 

 

 

 

 

 

 

 

 

 


 

 

 

 

 

 

 

 5. Since the next project to be deployed and run is not only php, but also the operation of the database, it is necessary to install the mysql extension module support of PHP. The specific steps are as follows

 

1) yum -y install php-mysql --enablerepo=remi install php-mysql module

 

2) If php wants to connect to mysql, it needs to use the header file and library file of mysql when compiling ( note: under normal circumstances, if php-mysql is successfully installed through yum in the previous step, then mysql.so will be generated )

  find / -name mysql.h

  find / -name mysql.so 

  

3) Find and cp to the extension_dir directory according to the path where the mysql.so library file is found. The extension_dir is set in php.ini

 

4) Modify php.ini, add extensions = "mysql.so" ( note: here is the plural of extensions, if there is one s missing, I won't know what's going on when I kill it, and I'll be trapped )

 

5) Restart php-fpm, the specific command (for php 5.4 version) is as follows

    php-fpm start:

    /usr/sbin/php-fpm 

    php-fpm shutdown:

    kill -INT `cat /var/run/php-fpm/php-fpm.pid` ( Note: here php-fpm.pid is only available after startup, the file is not there before it is not started for the first time )

    php-fpm restart:

    kill -USR2 `cat /var/run/php-fpm/php-fpm.pid`

 

    Check the number of php-fpm processes:

    ps to | grep -c php-fpm

 

6) Restart the httpd service and revisit info.php in the browser. At this time, if the full text search can search for the mysql keyword, it means that the relationship between php and mysql is ok

  

6. So far, the work is basically done. Next, upload ECShop_V2.7.3_UTF8_release1106.zip to the Linux server through ftp. The specific operations are as follows

  

1) unzip ECShop_V2.7.3_UTF8_release1106.zip
2) mkdir -p /usr/local/apache2/htdocs/ecshop/
3) mv ECShop_V2.7.3_UTF8_release1106/upload/* /usr/local/apache2/htdocs/ecshop/
4) cd /usr/local/apache2/htdocs/ecshop/
5) chmod -R 777 data/ temp/ cert/ includes/ images/ themes/

  

 7. Restart the httpd service, enter http://ip/ecshop/ in the browser and press Enter, the installation and configuration interface of ecshop will appear

 

 

8. Time-related errors may appear during the installation and configuration process. At this time, you need to edit and modify the php.ini configuration, open the comment and set date.timezone = UTC, and restart the httpd service to refresh.

 


 

9. After the installation is completed, there will be a confusing phenomenon on the home page "Strict Standards: Only variables should be passed by reference in D:\wamp\ecshop\includes\cls_template.php on line 422", it is said that this is the high version of php Caused by the following solutions:

 

 

Find the wrong file cls_template.php and line number

 

把 $tag_sel = array_shift(explode(' ', $tag));

 

Change it to:

$tag_arr = explode(' ', $tag); 

$tag_sel = array_shift($tag_arr);

 

10. Log in to the administrator background to clear all caches after finishing the event, refresh the front page again, and it's done perfectly.

 

Front page:

 

Background Home:


 

  The above is the whole process of building, deploying and running. Although it is not very complicated to sum up, if you are just starting out, you need to explore and research step by step. For those who focus on development, we may waste a little time. Here I spend Saturday morning. Time summary record and share it, I hope it can help everyone.

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327037525&siteId=291194637