Deploy Shopify PHP application to production environment (CentOS 7.7 64-bit in Alibaba Cloud, ECS, MySQL 5.7)
1. There is a Shopify PHP application, which can already be previewed in the development environment. as shown in Figure 1
2. Now it is ready to be deployed to the production environment. Shopify recommends creating a separate application if you need to deploy the application to the production environment. This application shares the code base with the development and test environments, but has its own records and configurations in the Shopify Partner Center. To avoid the application of production environments that affect the production environment during development and testing. Use Shopify Partners
Create the app from scratch: learn-php-app-0605-prod. as shown in Figure 2
3. Retrieve environment variables so that they can be set in later steps. Note the ScoPes, Shopify_API_KEY, and Shopify_API_Secret values. You need to set these values as environment variables that host the application.
wangqiang@desktop-qlpk8qm:/mnt/e/wwwroot/shopify-app/learn-php-app-ubuntu-2004-0605$ npm run Shopify App Env Show > learn-php-app-ubuntu-2004-0605@1.0.0 Shopify > Shopify App Env Show ? Which existing app is this for? ✔ learn-php-app-0605-prod Shopify_API_KEY=C7F826670575F7AE069F7E56350465EF Shopify_API_Secret=4DE64AA8281E97055CF7698BBE56039E Scopes=write_products
4. Reference:Based on Alibaba Cloud’s ECS and RDS, the personal blog migration has been upgraded to: Docker (based on budget considerations, ultimately not realized), LNMP (CentOS 7.7, Nginx 1.16, MySQL 5.7, PHP 7.4), the process of HTTPS , the previous environment was based on the automatic installation of OneInstack. PHP version 7.4 is no longer eligible for Shopify applications. It needs to be upgraded to version 8.1, trying to be consistent with the local environment.
[root@iZ23wv7v5ggZ ~]# php -v PHP 7.4.0 (CLI) (Built: Dec 5 2019 11:56:30) (NTS ) Copyright (C) The PHP Group Zend Engine v3.4.0, Copyright (C) Zend Technologies With Zend Opcache v7.4.0, Copyright (C), by Zend Technologies
wangqiang@desktop-qlpk8qm:/mnt/e/wwwroot/shopify-app/learn-php-app-ubuntu-2004-0605$ php -v PHP 8.1.18 (CLI) (Built: APR 14 2023 04:39:24) (NTS) Copyright (C) The PHP Group Zend Engine v4.1.18, Copyright (C) Zend Technologies With Zend Opcache v8.1.18, Copyright (C), by Zend Technologies
5. Reference:Uninstall PHP 7.4 in CentOS 7.7 in Alibaba Cloud and install PHP 8.
6. Check the PHP version of ECS in Alibaba Cloud
[root@iZ23wv7v5ggZ ~]# php -v PHP 8.1.19 (CLI) (built: Jun 7 2023 11:34:24) (NTS) Copyright (C) The PHP Group Zend Engine v4.1.19, Copyright (C) Zend Technologies With Zend Opcache v8.1.19, Copyright (C), by Zend Technologies [root@iZ23wv7v5ggZ ~]#
7. When adding a virtual host, setting the SSL certificate failed: lets Encrypt verify error! DNS problem, you need to set the resolution of the domain name first.
[root@iZ23wv7v5ggZ www.shuijingwanwq.com]# ~/oneinstack/vhost.sh
############################ ############################
# OneInStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+ #
# for more information please visit https://oneinstack.com #
############################ ############################
What are you doing?
1. Use HTTP only
2. Use your own SSL certificate and key
3. Use lets encrypt to create ssl certificate and key
Q. exit
Please input the correct option: 3
please input domain(example: www.example.com): learn-php-app-0605-prod.shuijingwanwq.com
domain=learn-php-app-0605-prod.shuijingwanwq.com
Please input the directory for the domain:learn-php-app-0605-prod.shuijingwanwq.com :
(default directory: /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com):
Virtual Host Directory=/data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com
Create virtul host directory...
Set Permissions of Virtual Host Directory...
Do you want to add more domain name?[y/n]: n
Do you want to redirect all http requests to https?[y/n]: Y
Please select domain cert key length.
Enter one of 2048, 3072, 4096, 8192 Will Issue a RSA Cert.
Enter one of EC-256, EC-384, EC-521 will issue a ECC cert.
Please enter your cert key length (default 2048):
lets encrypt verify error! DNS problem: nxdomain looking up a for learn-php-app-0605-prod.shuijingwanwq.com
[Wed Jun 7 04:44:59 PM CST 2023]Using CA: https://acme.zerossl.com/v2/dv90
[Wed Jun 7 04:44:59 PM CST 2023]Creating domain key
[Wed Jun 7 04:44:59 PM CST 2023]The domain key is here: /root/.acme.sh/learn-php-0605-prod.shuijingwanwq.com/learn-php-app-0605-prod.shuijingwanwq.com.key
[Wed Jun 7 04:44:59 PM CST 2023]single domain=learn-php-app-0605-prod.shuijingwanwq.com
[Wed Jun 7 04:44:59 PM CST 2023]Getting domain auth token for each domain
[Wed Jun 7 04:45:05 PM CST 2023]Getting webroot for domain=learn-php-app-0605-prod.shuijingwanwq.com
[Wed Jun 7 04:45:05 PM CST 2023]Verify: learn-php-app-0605-prod.shuijingwanwq.com
[Wed Jun 7 04:45:07 PM CST 2023]Processing, the ca is processing your order, please just wait. (1/30)
[Wed Jun 7 04:45:11 PM CST 2023]learn-php-app-0605-prod.shuijingwanwq.com:verify error:"error":{
[Wed Jun 7 04:45:11 PM CST 2023]please add--debugOr--logTo check more details.
[Wed Jun 7 04:45:11 PM CST 2023]See: https://github.com/acmesh-official/acme.sh/wiki/how-to-debug-acme.sh
Error: create lets encrypt ssl certificate failed!
[root@iZ23wv7v5ggZ www.shuijingwanwq.com]#
8. Add records in Alibaba Cloud Parsing DNS. as shown in Figure 3
9. Add the virtual host again
[root@iZ23wv7v5ggZ www.shuijingwanwq.com]# ~/oneinstack/vhost.sh ############################ ############################ # OneInStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+ # # for more information please visit https://oneinstack.com # ############################ ############################ What are you doing? 1. Use HTTP only 2. Use your own SSL certificate and key 3. Use lets encrypt to create ssl certificate and key Q. exit Please input the correct option: 3 please input domain(example: www.example.com): learn-php-app-0605-prod.shuijingwanwq.com domain=learn-php-app-0605-prod.shuijingwanwq.com Please input the directory for the domain:learn-php-app-0605-prod.shuijingwanwq.com : (default directory: /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com): Virtual Host Directory=/data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com Create virtul host directory... Set Permissions of Virtual Host Directory... Do you want to add more domain name?[y/n]: n Do you want to redirect all http requests to https?[y/n]: Y Please select domain cert key length. Enter one of 2048, 3072, 4096, 8192 Will Issue a RSA Cert. Enter one of EC-256, EC-384, EC-521 will issue a ECC cert. Please enter your cert key length (default 2048): [Wed Jun 7 04:51:49 PM CST 2023]Using CA: https://acme.zerossl.com/v2/dv90 [Wed Jun 7 04:51:49 PM CST 2023]single domain=learn-php-app-0605-prod.shuijingwanwq.com [Wed Jun 7 04:51:49 PM CST 2023]Getting domain auth token for each domain [Wed Jun 7 04:51:54 PM CST 2023]Getting webroot for domain=learn-php-app-0605-prod.shuijingwanwq.com [Wed Jun 7 04:51:54 PM CST 2023]Verify: learn-php-app-0605-prod.shuijingwanwq.com [Wed Jun 7 04:51:55 PM CST 2023]Processing, the ca is processing your order, please just wait. (1/30) [Wed Jun 7 04:52:01 PM CST 2023]succeed [Wed Jun 7 04:52:01 PM CST 2023]verify, start to sign. [Wed Jun 7 04:52:01 PM CST 2023]Lets finalize the order. [Wed Jun 7 04:52:01 PM CST 2023]le_orderfinalize=https://acme.zerossl.com/v2/DV90/Order/CLF6PxWjKDXtQYLGNXS_JG/Finalize [Wed Jun 7 04:52:02 PM CST 2023]Order status is processing, lets sleep and retry. [Wed Jun 7 04:52:02 PM CST 2023]Retry After: 15 [Wed Jun 7 04:52:18 PM CST 2023]polling order status: https://acme.zerossl.com/v2/dv90/order/cluxwjkdxtqylgnxs_jg [Wed Jun 7 04:52:20 PM CST 2023]downloading cert. [Wed Jun 7 04:52:20 PM CST 2023]le_linkcert=https://acme.zerossl.com/v2/dv90/cert/b2urnjrfyvap2b9aqq2_lw [Wed Jun 7 04:52:22 PM CST 2023]cert success. -----Begin Certificate----- ****************** -----end certificate----- [Wed Jun 7 04:52:22 PM CST 2023]your cert is in: /root/.acme.sh/learn-php-0605-prod.shuijingwanwq.com/learn-php-app-0605-prod.shuijingwanwq.com.cer [Wed Jun 7 04:52:22 PM CST 2023]Your cert key is in: /root/.acme.sh/learn-php-0605-prod.shuijingwanwq.com/learn-php-app-0605-prod.shuijingwanwq.com.key [Wed Jun 7 04:52:22 PM CST 2023]The international CA cert is in: /root/.acme.sh/learn-php-app-0605-prod.shuijingwanwq.com/ca.cer [Wed Jun 7 04:52:22 PM CST 2023]And the full chain certs is there: /root/.acme.sh/learn-php-app-0605-prod.shuijingwanwq.com/fullchain.cer Do you want to add hotlink protection?[y/n]: Y Allow rewrite rule?[y/n]: Y Please input the rewrite of program : WordPress, OpenCart, Magento2, Drupal, Joomla, CodeIgniter, Laravel thinkphp, pathinfo, Discuz, typecho, ecshop, nextcloud, zblog, whmcs rewrite was exist. (default rewrite: other): Laravel you choose rewrite=laravel allow nginx/tenengine/openresty access_log?[y/n]: Y you access log file=/data/wwwlogs/learn-php-app-0605-prod.shuijingwanwq.com_nginx.log Nginx: The configuration file /usr/local/nginx/conf/nginx.conf syntax is OK Nginx: configuration file /usr/local/nginx/conf/nginx.conf test is success reload nginx...... ############################ ############################ # OneInStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+ # # for more information please visit https://oneinstack.com # ############################ ############################ Your Domain: learn-php-app-0605-prod.shuijingwanwq.com virtualhost conf: /usr/local/nginx/conf/vhost/learn-php-app-0605-prod.shuijingwanwq.com.conf Directory of: /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com rewrite rule: /usr/local/nginx/conf/rewrite/laravel.conf lets encrypt ssl certificate:/usr/local/nginx/conf/ssl/learn-php-app-0605-prod.shuijingwanwq.com.crt SSL private key: /usr/local/nginx/conf/ssl/learn-php-app-0605-prod.shuijingwanwq.com.key [root@iZ23wv7v5ggZ www.shuijingwanwq.com]#
10. Add an FTP account
[root@iZ23wv7v5ggZ www.shuijingwanwq.com]# ~/oneinstack/pureftpd_vhost.sh ############################ ############################ # OneInStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+ # # ftp virtual user account management # # for more information please visit https://oneinstack.com # ############################ ############################ What are you doing? 1. useradd 2. UserMod 3. UserPasswd 4. UserDel 5. ListAllUser 6. ShowUser Q. exit Please input the correct option: 1 Please input a username: learn-php-app-0605-prod.shuijingwanwq.com Please input the password: XZZQPC4K3CLF6OUP26E Please input the directory(default directory: /data/wwwRoot): /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com password: Enter it again: ############################# [learn-php-app-0605-prod.shuijingwanwq.com]create successful! You user name is : learn-php-app-0605-prod.shuijingwanwq.com You password is : *********** You directory is : /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com
11. At this time, it is necessary to build applications in the production environment in the local environment to avoid building in the production environment, because the prerequisites required for construction in the production environment are temporarily not supported, such as npm, composer, etc. Shopify_api_key needs to use the variable value retrieved in step 3. Copy the application directory learn-php-app-ubuntu-2004-0605/web is learn-php-app-0605-prod. The directory learn-php-app-0605-prod only needs to be built and uploaded to the production environment. Therefore, the dependency files of the development environment are not required.
wangqiang@desktop-qlpk8qm:/mnt/e/wwwroot/shopify-app$ cd learn-php-app-0605-prod/ wangqiang@desktop-qlpk8qm:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod$ ls -l Total 300 drwxrwxrwx 1 wangqiang wangqiang 4096 Jun 7 17:38 APP -RWXRWXRWX 1 wangqiang wangqiang 1690 Jun 5 15:02 Artisan drwxrwxrwx 1 wangqiang wangqiang 4096 Jun 7 17:38 Bootstrap -rwxrwxrwx 1 wangqiang wangqiang 2238 jun 5 15:02 composer.json -RWXRWXRWX 1 wangqiang wangqiang 304694 Jun 6 09:35 composer.lock drwxrwxrwx 1 wangqiang wangqiang 4096 Jun 7 17:38 config drwxrwxrwx 1 wangqiang wangqiang 4096 Jun 7 17:38 database -RWXRWXRWX 1 wangqiang wangqiang 450 jun 5 15:02 entrypoint.sh drwxrwxrwx 1 wangqiang wangqiang 4096 Jun 7 17:39 Frontend -rwxrwxrwx 1 wangqiang wangqiang 860 jun 5 15:00 nginx.conf -rwxrwxrwx 1 wangqiang wangqiang 1202 jun 5 15:00 phpunit.xml drwxrwxrwx 1 wangqiang wangqiang 4096 Jun 7 17:39 Public drwxrwxrwx 1 wangqiang wangqiang 4096 Jun 7 17:39 Resources DRWXRWXRWX 1 wangqiang wangqiang 4096 Jun 7 17:39 Routes -rwxrwxrwx 1 wangqiang wangqiang 563 jun 5 15:00 server.php -rwxrwxrwx 1 wangqiang wangqiang 75 Jun 5 15:00 Shopify.Web.toml drwxrwxrwx 1 wangqiang wangqiang 4096 Jun 7 17:39 Storage drwxrwxrwx 1 wangqiang wangqiang 4096 Jun 7 17:42 Vendor
12. Edit .env, set to the configuration value in the production environment
app_name="shopify php app 0605 prod" app_env=production app_key=*********** app_debug=false log_channel=stack log_level=debug db_connection=mysql DB_HOST=************** DB_PORT=3306 db_database=learn_php_app_0605_prod db_username=learn_php_app_0605_prod DB_PASSWORD=************
13. To build the front-end and back-end, report an error: /bin/sh: 1: vite: not found, you need to execute: npm install . as shown in Figure 4
wangqiang@desktop-qlpk8qm:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/frontend$ Shopify_API_KEY=C7F826670575F7AE069F7E56350465EF Yarn Build YARN RUN v1.22.15 $vite build /bin/sh: 1: vite: not found Error command failed with exit code 127. Info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. wangqiang@desktop-qlpk8qm:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/frontend$ npm install npm warn deprecated w3c-hr-time@1.0.2: use your platforms native performance.now() and performance.timeorigin. Added 354 packages, and audited 360 packages in 3M 41 packages are looking for funding run `npm fund` for details found 0 vulnerabilities wangqiang@desktop-qlpk8qm:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/frontend$ Shopify_API_KEY=C7F826670575F7AE069F7E56350465EF npm run build > shopify-frontend-template-react@1.0.0 build > vite build VITE V4.3.9 Building for Production... ✓ 1966 Modules Transformed. Dist/Assets/Empty-State-8039A1E1.SVG 0.26 KB │ GZIP: 0.20 KB dist/index.html 0.48 KB │ Gzip: 0.33 KB dist/assets/home-trophy-d70b3542.png 20.65 KB Dist/Assets/Index-37530742.CSS 371.48 KB │ Gzip: 45.42 KB Dist/Assets/KO-EF9A93F5.js 0.21 KB │ Gzip: 0.15 KB dist/assets/ja-abb1af27.js 0.21 KB │ GZIP: 0.15 KB dist/assets/zh-4775ba45.js 0.21 KB │ GZIP: 0.15 KB dist/assets/th-32f01d1c.js 0.21 KB │ GZIP: 0.15 KB Dist/Assets/VI-72F55A87.js 0.23 KB │ GZIP: 0.17 KB Dist/Assets/NB-79727CD5.js 0.24 KB │ Gzip: 0.17 KB dist/assets/tr-d5c962f0.js 0.24 KB │ Gzip: 0.17 KB Dist/Assets/NL-ED6C02B1.js 0.28 KB │ GZIP: 0.20 KB dist/assets/de-5d4a5256.js 0.28 KB │ GZIP: 0.20 KB Dist/Assets/FI-E67A7779.js 0.28 KB │ Gzip: 0.20 KB Dist/Assets/DA-9B835BB8.js 0.31 KB │ Gzip: 0.22 KB dist/assets/cs-d855408e.js 0.32 KB │ Gzip: 0.23 KB Dist/Assets/SV-8AC62B51.js 0.37 KB │ GZIP: 0.25 KB dist/assets/en-d265ad8d.js 0.41 KB │ GZIP: 0.26 KB dist/assets/es-fd2f35f4.js 0.41 KB │ GZIP: 0.29 KB dist/assets/pt-227fd344.js 0.41 KB │ GZIP: 0.29 KB Dist/Assets/PT-A0C51464.js 0.41 KB │ Gzip: 0.29 KB Dist/Assets/PL-AB15C7EA.js 0.42 KB │ GZIP: 0.29 KB Dist/Assets/FR-23E50D95.js 0.43 KB │ Gzip: 0.29 KB dist/assets/it-08f76780.js 0.45 KB │ Gzip: 0.30 KB dist/assets/en-df34a502.js 1.53 KB │ GZip: 0.77 KB dist/assets/de-2ae5c9fa.js 1.72 KB │ GZip: 0.90 KB dist/assets/fr-5253333d.js 1.83 KB │ GZIP: 0.94 KB dist/assets/polyfill-force-11887b4b.js 5.21 KB │ GZIP: 2.03 KB dist/assets/en-cf74d136.js 7.72 KB │ GZIP: 3.26 KB dist/assets/zh-tw-6a74a185.js 7.86 KB │ GZIP: 3.36 KB Dist/Assets/KO-2CF626E6.js 8.18 KB │ Gzip: 3.39 KB dist/assets/ja-6f78282b.js 8.35 KB │ Gzip: 3.58 KB dist/assets/en-c240dff3.js 9.95 KB │ GZIP: 2.95 KB Dist/Assets/VI-E4EF4FD6.js 9.97 KB │ GZIP: 3.34 KB dist/assets/th-2a34d5e0.js 10.14 KB │ Gzip: 3.77 KB Dist/Assets/SV-A901B08F.js 10.22 KB │ GZIP: 3.27 KB Dist/Assets/DA-1564850B.js 10.30 KB │ Gzip: 3.26 KB Dist/Assets/NB-0A6D8490.js 10.35 KB │ GZIP: 3.25 KB Dist/Assets/PL-A603E9C2.js 10.39 KB │ Gzip: 3.39 KB Dist/Assets/CS-3C753A97.js 10.40 KB │ GZIP: 3.50 KB Dist/Assets/Fi-C0A9D95F.js 10.63 KB │ GZIP: 3.41 KB dist/assets/tr-bd45be97.js 10.68 KB │ Gzip: 3.39 KB dist/assets/it-8bb02787.js 10.72 KB │ GZIP: 3.32 KB Dist/Assets/PT-AF188C06.js 10.85 KB │ GZIP: 3.34 KB Dist/Assets/NL-0772EA77.js 10.89 KB │ GZIP: 3.25 KB dist/assets/pt-br-8a1d5660.js 10.94 KB │ GZIP: 3.36 KB dist/assets/es-5e0e20e7.js 10.95 KB │ Gzip: 3.39 KB dist/assets/de-a04fe3bd.js 11.11 KB │ Gzip: 3.35 KB Dist/Assets/FR-1848494A.js 11.31 KB │ Gzip: 3.48 KB dist/assets/index-41437cc7.js 53.59 KB │ GZIP: 18.93 KB dist/assets/polyfill-904c231f.js 133.64 KB │ GZIP: 40.74 KB Dist/Assets/Index-991532E3.js 618.82 KB │ GZIP: 164.28 KB (!) Some chunks are large than 500 kbs after miniification. Consider: - using dynamic import() to code-split the application - use build.rollupoptions.output.manualchunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks - Adjust chunk size limit for this warning via build.ChunkSizeWarningLimit. ✓ Built in 47.73s wangqiang@desktop-qlpk8qm:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod$ composer build > composer build-frontend-links > ln -sf ../frontend/dist/assets public/assets && ln -sf ../frontend/dist/index.html public/index.html wangqiang@desktop-qlpk8qm:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod$ cd public/ wangqiang@desktop-qlpk8qm:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/public$ ls -l total 0 lrwxrwxrwx 1 wangqiang wangqiang 23 jun 6 10:06 assets -> ../frontend/dist/assets -rwxrwxrwx 1 wangqiang wangqiang 0 jun 5 15:00 favicon.ico lrwxrwxrwx 1 wangqiang wangqiang 27 Jun 8 09:45 index.html -> ../frontend/dist/index.html -rwxrwxrwx 1 wangqiang wangqiang 1743 Jun 5 15:00 index.php -rwxrwxrwx 1 wangqiang wangqiang 24 jun 5 15:00 robots.txt
14. Upload all files under the directory learn-php-app-0605-prod based on FTP. The total size is about 150 MB. The upload time is too long, and the most decided to build it in the production environment. Directory: vendor, frontend/node_modules can not be uploaded. as shown in Figure 5
15. Install node.js and composer, node.js needs to restart the instance after installation
[root@iZ23wv7v5ggZ ~]# ~/oneinstack/install.sh --node ############################ ############################ # OneInStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+ # # for more information please visit https://oneinstack.com # ############################ ############################ download nodejs... --2023-06-08 10:45:47-- https://mirrors.tuna.tsinghua.edu.cn/nodejs-r elease/v18.14.2/node-v18.14.2-linux-x64.tar.gz resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.15.130, 2402:F000:1:400::2 Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.15.130|:443... connected. Http request sent, awaiting response... 200 OK Length: 44201520 (42M)[application/octet-stream] Saving to: 'node-v18.14.2-linux-x64.tar.gz' 0k ...................................................................... 0% 878K 49s 50K ..................................................................... 0% 1.79m 36s 43150K ......... 100% 14.2m=2.7s 2023-06-08 10:45:50 (15.7 MB/s) - 'node-v18.14.2-x64.tar.gz' saved[44201520/44201520] nodejs installed successfully! [xprober.php]found ###############Congratulations################## Total OneInstack Install Time: 0 Minutes [root@iZ23wv7v5ggZ ~]# node -v -bash: node: command not found [root@iZ23wv7v5ggZ ~]# ~/oneinstack/addons.sh ############################ ############################ # OneInStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+ # # install/uninstall extensions # # for more information please visit https://oneinstack.com # ############################ ############################ What are you doing? 1. install/uninstall php composer 2. install/uninstall fail2ban 3. install/uninstall ngx_lua_waf 4. install/uninstall python3.6 Q. exit Please input the correct option: 1 please select an action: 1. install 2. uninstall Please input a number:(default 1 press enter) 1 PHP composer installed successfully! What are you doing? 1. install/uninstall php composer 2. install/uninstall fail2ban 3. install/uninstall ngx_lua_waf 4. install/uninstall python3.6 Q. exit Please input the correct option: Q [root@iZ23wv7v5ggZ ~]# composer -v composer version 2.5.7 2023-05-24 15:00:39 [root@iZ23wv7v5ggZ ~]# node -v v18.14.2
16. After the FTP upload is completed, create a database (the connection information is consistent with the .env), generate APP_KEY, perform database migration, and build front-end and back-end
[root@iZ23wv7v5ggZ frontend]# npm install npm warn deprecated w3c-hr-time@1.0.2: use your platforms native performance.now() and performance.timeorigin. Added 359 packages, and audited 360 packages in 17s 41 packages are looking for funding run `npm fund` for details found 0 vulnerabilities npm notice NPM Notice New Minor Version of NPM Available! 9.5.0 -> 9.7.1 npm notice changelog: https://github.com/npm/cli/releases/tag/v9.7.1 npm notice run npm install -g npm@9.7.1 to update! npm notice [root@iZ23wv7v5ggZ frontend]# Shopify_API_KEY=C7F826670575F7AE069F7E56350465EF npm run build > shopify-frontend-template-react@1.0.0 build > vite build VITE V4.3.9 Building for Production... ✓ 1966 Modules Transformed. Dist/Assets/Empty-State-8039A1E1.SVG 0.26 KB │ GZIP: 0.20 KB dist/index.html 0.48 KB │ Gzip: 0.33 KB dist/assets/home-trophy-d70b3542.png 20.65 KB Dist/Assets/Index-37530742.CSS 371.48 KB │ Gzip: 45.42 KB dist/assets/ja-abb1af27.js 0.21 KB │ GZIP: 0.15 KB Dist/Assets/KO-EF9A93F5.js 0.21 KB │ Gzip: 0.15 KB dist/assets/th-32f01d1c.js 0.21 KB │ GZIP: 0.15 KB dist/assets/zh-4775ba45.js 0.21 KB │ GZIP: 0.15 KB Dist/Assets/VI-72F55A87.js 0.23 KB │ GZIP: 0.17 KB Dist/Assets/NB-79727CD5.js 0.24 KB │ Gzip: 0.17 KB dist/assets/tr-d5c962f0.js 0.24 KB │ Gzip: 0.17 KB dist/assets/de-5d4a5256.js 0.28 KB │ GZIP: 0.20 KB Dist/Assets/FI-E67A7779.js 0.28 KB │ Gzip: 0.20 KB Dist/Assets/NL-ED6C02B1.js 0.28 KB │ GZIP: 0.20 KB Dist/Assets/DA-9B835BB8.js 0.31 KB │ Gzip: 0.22 KB dist/assets/cs-d855408e.js 0.32 KB │ Gzip: 0.23 KB Dist/Assets/SV-8AC62B51.js 0.37 KB │ GZIP: 0.25 KB dist/assets/en-d265ad8d.js 0.41 KB │ GZIP: 0.26 KB dist/assets/es-fd2f35f4.js 0.41 KB │ GZIP: 0.29 KB dist/assets/pt-227fd344.js 0.41 KB │ GZIP: 0.29 KB Dist/Assets/PT-A0C51464.js 0.41 KB │ Gzip: 0.29 KB Dist/Assets/PL-AB15C7EA.js 0.42 KB │ GZIP: 0.29 KB Dist/Assets/FR-23E50D95.js 0.43 KB │ Gzip: 0.29 KB dist/assets/it-08f76780.js 0.45 KB │ Gzip: 0.30 KB dist/assets/en-df34a502.js 1.53 KB │ GZip: 0.77 KB dist/assets/de-2ae5c9fa.js 1.72 KB │ GZip: 0.90 KB dist/assets/fr-5253333d.js 1.83 KB │ GZIP: 0.94 KB dist/assets/polyfill-force-11887b4b.js 5.21 KB │ GZIP: 2.03 KB dist/assets/en-cf74d136.js 7.72 KB │ GZIP: 3.26 KB dist/assets/zh-tw-6a74a185.js 7.86 KB │ GZIP: 3.36 KB Dist/Assets/KO-2CF626E6.js 8.18 KB │ Gzip: 3.39 KB dist/assets/ja-6f78282b.js 8.35 KB │ Gzip: 3.58 KB dist/assets/en-c240dff3.js 9.95 KB │ GZIP: 2.95 KB Dist/Assets/VI-E4EF4FD6.js 9.97 KB │ GZIP: 3.34 KB dist/assets/th-2a34d5e0.js 10.14 KB │ Gzip: 3.77 KB Dist/Assets/SV-A901B08F.js 10.22 KB │ GZIP: 3.27 KB Dist/Assets/DA-1564850B.js 10.30 KB │ Gzip: 3.26 KB Dist/Assets/NB-0A6D8490.js 10.35 KB │ GZIP: 3.25 KB Dist/Assets/PL-A603E9C2.js 10.39 KB │ Gzip: 3.39 KB Dist/Assets/CS-3C753A97.js 10.40 KB │ GZIP: 3.50 KB Dist/Assets/Fi-C0A9D95F.js 10.63 KB │ GZIP: 3.41 KB dist/assets/tr-bd45be97.js 10.68 KB │ Gzip: 3.39 KB dist/assets/it-8bb02787.js 10.72 KB │ GZIP: 3.32 KB Dist/Assets/PT-AF188C06.js 10.85 KB │ GZIP: 3.34 KB Dist/Assets/NL-0772EA77.js 10.89 KB │ GZIP: 3.25 KB dist/assets/pt-br-8a1d5660.js 10.94 KB │ GZIP: 3.36 KB dist/assets/es-5e0e20e7.js 10.95 KB │ Gzip: 3.39 KB dist/assets/de-a04fe3bd.js 11.11 KB │ Gzip: 3.35 KB Dist/Assets/FR-1848494A.js 11.31 KB │ Gzip: 3.48 KB dist/assets/index-41437cc7.js 53.59 KB │ GZIP: 18.93 KB dist/assets/polyfill-904c231f.js 133.64 KB │ GZIP: 40.74 KB Dist/Assets/Index-991532E3.js 618.82 KB │ GZIP: 164.28 KB (!) Some chunks are large than 500 kbs after miniification. Consider: - using dynamic import() to code-split the application - use build.rollupoptions.output.manualchunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks - Adjust chunk size limit for this warning via build.ChunkSizeWarningLimit. ✓ Built in 21.56s [root@iZ23wv7v5ggZ frontend]# cd .. [root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# composer install Installing dependencies from lock file (inclusion require-dev) Verifying lock file contents can be installed on current platform. Your lock file doesn't contain a compareable set of packages. Please run composer update. problem 1 - League/FlySystem is locked to version 1.1.10 and an update of this package was not requested. - League/FlySystem 1.1.10 require ext-fileinfo * -> it is missing from your system. install or enable phps fileinfo extension. problem 2 - League/MIME-Type-detection is locked to version 1.11.0 and an update of this package was not requested. -League/mime-type-detection 1.11.0 requires ext-fileinfo * -> it is missing from your system. install or enable phps fileinfo extension. problem 3 - League/FlySystem 1.1.10 require ext-fileinfo * -> it is missing from your system. install or enable phps fileinfo extension. - Laravel/Framework v8.83.27 require League/FlySystem ^1.1 -> satisfiable by League/FlySystem[1.1.10]. - Laravel/framework is locked to version v8.83.27 and an update of this package was not requested. To enable extensions, verify that they are enabled in your .ini files: - /usr/local/php/etc/php.ini - /usr/local/php/etc/php.d/02-opcache.ini - /usr/local/php/etc/php.d/03-imagick.ini - /usr/local/php/etc/php.d/04-ldap.ini - /usr/local/php/etc/php.d/05-redis.ini - /usr/local/php/etc/php.d/07-mongodb.ini You can also run `php --ini` in a terminal to see which files are used by php in CLI mode. Alternatively, you can run composer with `--ignore-platform-req=ext-fileinfo` to temporarily ignore these required extensions.
17. After installing the PHP extension FileInfo, execute it again. Error: The process class relies on proc_open, which is not available on your php installation.
[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# composer install Installing dependencies from lock file (inclusion require-dev) Verifying lock file contents can be installed on current platform. Package operations: 114 installs, 0 updates, 0 removals Proc_Open is disabled sounzipAnd7zCommands cannot be used, zip files are being unlocked using the php zip extension. This may cause invalid reports of corrupted archives. Archives will be lost. Enabling Proc_Open and InstallingunzipOr7z(21.01+) May remediate them. - downloading brick/math (0.11.0) - downloading PSR/log (2.0.0) - Download PSR/Cache (3.0.0) - Downloading Doctrine/Event-Manager (2.0.0) - downloading doctrine/deprecations (v1.1.1) - downloading doctrine/cache (2.2.0) - downloading doctrine/dbal (3.6.3) - downloading doctrine/lexer (1.2.3) - downloading symfony/polyfill-ctype (v1.27.0) - downloading webmozart/assert (1.11.0) - downloading dragonmantank/cron-expression (v3.3.2) - downloading symfony/polyfill-php80 (v1.27.0) - downloading symfony/polyfill-mbstring (v1.27.0) - downloading symfony/var-dumper (v5.4.24) - downloading symfony/polyfill-intl-normalizer (v1.27.0) - downloading symfony/polyfill-intl-graphe (v1.27.0) - downloading symfony/string (v6.3.0) - downloading symfony/deprecation-contracts (v3.3.0) - downloading PSR/Container (1.1.2) - downloading symfony/service-contracts (v2.5.2) - downloading symfony/polyfill-php73 (v1.27.0) - downloading symfony/console (v5.4.24) - downloading monolog/monolog (2.9.1) - downloading voku/portable-ascii (1.6.1) - downloading phpooption/phpooption (1.9.1) - downloading graham-campbell/result-type (v1.1.1) - downloading vlucas/phpdotenv (v5.5.0) - Downloading Symfony/CSS-Selector (v6.3.0) - downloading tijsverkoyen/css-to-inline-styles (2.2.6) - downloading symfony/routing (v5.4.22) - downloading symfony/process (v5.4.24) - downloading symfony/polyfill-php72 (v1.27.0) - downloading symfony/polyfill-intl-idn (v1.27.0) - downloading symfony/mime (v5.4.23) - downloading symfony/http-foundation (v5.4.24) - Download PSR/Event-Dispatcher (1.0.0) - downloading symfony/event-dispatcher-contracts (v3.3.0) - downloading symfony/event-dispatcher (v6.3.0) - downloading symfony/error-handler (v5.4.24) - downloading symfony/http-kernel (v5.4.24) - downloading symfony/finder (v5.4.21) - downloading symfony/polyfill-iconv (v1.27.0) - downloading egulias/email-validator (2.1.25) - Downloading SwiftMailer/SwiftMailer (v6.3.0) - Downloading Ramsey/Collection (2.0.0) - downloading ramsey/uuid (4.7.4) - downloading PSR/simple-cache (1.0.1) - Downloading OPIS/Closure (3.6.3) - downloading symfony/translation-contracts (v3.3.0) - downloading symfony/translation (v6.3.0) - Download Nesbot/Carbon (2.67.0) - Downloading League/MIME-Type-detection (1.11.0) - Downloading League/FlySystem (1.1.10) - Downloading nette/utils (v4.0.0) - Downloading nette/schema (v1.2.3) - downloading dflydev/dot-access-data (v3.0.2) - Downloading League/Config (v1.2.0) - Downloading League/CommonMark (2.4.0) - downloading laravel/serializable-closure (v1.3.0) - Downloading Doctrine/Inflector (2.0.6) - Downloading Laravel/Framework (v8.83.27) - Download Facade/Ignition-Contracts (1.0.2) - downloading facade/flare-client-php (1.10.0) - Download Facade/Ignition (2.17.7) - downloading fakerphp/faker (v1.22.0) - downloading fideloper/proxy (4.4.2) - downloading fruitcake/php-cors (v1.2.0) - Downloading fruitcake/Laravel-cors (v3.0.0) - downloading guzzlehttp/promises (2.0.0) - downloading symfony/yaml (v6.3.0) - Download Laravel/Sail (v1.22.0) - Download Nikic/PHP-Parser (v4.15.5) - Downloading PSY/PSYSH (v0.11.18) - Downloading Laravel/Tinker (v2.8.1) - downloading hamcrest/hamcrest-php (v2.0.1) - downloading mockery/mockery (1.6.1) - downloading filp/whoops (2.15.2) - downloading nunomaduro/collision (v5.11.0) - downloading sebastian/version (3.0.2) - downloading sebastian/type (3.2.1) - downloading sebastian/resource-operations (3.0.3) - downloading sebastian/recursion-context (4.0.5) - downloading sebastian/object-reflector (2.0.4) - downloading sebastian/object-enumerator (4.0.4) - downloading sebastian/global-state (5.0.5) - downloading sebastian/exporter (4.0.5) - downloading sebastian/environment (5.1.5) - downloading sebastian/diff (4.0.5) - Downloading Sebastian/Comparator (4.0.8) - downloading sebastian/code-unit (1.0.8) - downloading sebastian/cli-parser (1.0.1) - downloading phpunit/php-timer (5.0.3) - downloading phpunit/php-text-template (2.0.4) - downloading phpunit/php-invoker (3.1.1) - downloading phpunit/php-file-iterator (3.0.6) - downloading theseer/tokenizer (1.2.1) - downloading sebastian/lines-of-code (1.0.3) - Downloading Sebastian/Complexity (2.0.2) - downloading sebastian/code-unit-reverse-lookup (2.0.3) - downloading phpunit/php-code-coverage (9.2.26) - downloading phar-io/version (3.2.1) - Downloading Phar-IO/Manifest (2.0.3) - downloading myclabs/deep-copy (1.11.1) - Downloading Doctrine/Instantiator (2.0.0) - downloading phpunit/phpunit (9.6.8) - Downloading PSR/HTTP-Message (1.1) - downloading PSR/HTTP-factory (1.0.2) - Download raluphie/GetAllHeaders (3.0.3) - Download PSR/HTTP-Client (1.0.2) - downloading guzzlehttp/psr7 (2.5.0) - downloading guzzlehttp/guzzle (7.7.0) - downloading firebase/php-jwt (v6.5.0) - Download Shopify/Shopify-API (v5.0.0) - downloading squizlabs/php_codesniffer (3.7.2) - Installing Brick/Math (0.11.0): Extracting Archive - Installing PSR/Log (2.0.0): Extracting Archive - Installing PSR/Cache (3.0.0): Extracting Archive - Installing Doctrine/Event-Manager (2.0.0): Extracting Archive - Installing Doctrine/Deprecations (v1.1.1): Extracting Archive - Installing Doctrine/Cache (2.2.0): Extracting Archive - Installing Doctrine/DBAL (3.6.3): Extracting Archive - Installing Doctrine/Lexer (1.2.3): Extracting Archive - Installing symfony/polyfill-ctype (v1.27.0): extracting archive - Installing WebMozart/Assert (1.11.0): Extracting Archive - Installing DragonMantank/cron-expression (v3.3.2): Extracting Archive - Installing symfony/polyfill-php80 (v1.27.0): extracting archive - Installing symfony/polyfill-mbstring (v1.27.0): Extracting Archive - Installing symfony/var-dumper (v5.4.24): Extracting Archive - Installing symfony/polyfill-intl-normalizer (v1.27.0): Extracting Archive - Installing symfony/polyfill-intl-graphe (v1.27.0): Extracting Archive - Installing symfony/string (v6.3.0): Extracting Archive - Installing symfony/deprecation-contracts (v3.3.0): extracting archives - Installing PSR/Container (1.1.2): Extracting Archive - Installing symfony/service-contracts (v2.5.2): extracting archive - Installing symfony/polyfill-php73 (v1.27.0): extracting archive - Installing symfony/console (v5.4.24): Extracting Archive - Installing Monolog/Monolog (2.9.1): Extracting Archive - Installing voku/portable-ascii (1.6.1): Extracting Archive -Installing phpooption/phpoption (1.9.1): Extracting Archive - Installing grad-campbell/result-type (v1.1.1): Extracting Archive - Installing vlucas/phpdotenv (v5.5.0): Extracting Archive - Installing symfony/css-selector (v6.3.0): Extracting Archive -Installing tijsverkoyen/css-to-inline-styles (2.2.6): Extracting Archive - Installing symfony/routing (v5.4.22): Extracting Archive - Installing Symfony/Process (v5.4.24): Extracting Archive - Installing symfony/polyfill-php72 (v1.27.0): extracting archive - Installing symfony/polyfill-intl-idn (v1.27.0): Extracting Archive - Installing symfony/MIME (v5.4.23): Extracting Archive - Installing symfony/http-foundation (v5.4.24): Extracting Archive - Installing PSR/Event-Dispatcher (1.0.0): Extracting Archive - Installing symfony/event-dispatcher-contracts (v3.3.0): Extracting Archive - Installing Symfony/Event-Dispatcher (v6.3.0): Extracting Archive - Installing symfony/error-handler (v5.4.24): extracting archive - Installing symfony/http-kernel (v5.4.24): Extracting Archive - Installing symfony/finder (v5.4.21): Extracting Archive - Installing symfony/polyfill-iconv (v1.27.0): Extracting Archive - Installing egulias/email-validator (2.1.25): Extracting Archive - Installing SwiftMailer/SwiftMailer (v6.3.0): Extracting Archive - Installing Ramsey/Collection (2.0.0): Extracting Archive - Installing Ramsey/UUID (4.7.4): Extracting Archive - Installing PSR/simple-cache (1.0.1): Extracting Archive - Installing OPIS/Closure (3.6.3): Extracting Archive -Installing symfony/translation-contracts (v3.3.0): Extracting Archive - Installing symfony/translation (v6.3.0): Extracting Archive - Installing Nesbot/Carbon (2.67.0): Extracting Archive - Installing League/MIME-Type-detection (1.11.0): Extracting Archive - Installing League/FlySystem (1.1.10): Extracting Archive - Installing nette/utils (v4.0.0): Extracting Archive - Installing nette/schema (v1.2.3): Extracting Archive - Installing dflydev/dot-access-data (v3.0.2): extracting archive - Installing League/Config (v1.2.0): Extracting Archive - Installing League/CommonMark (2.4.0): Extracting Archive - Installing Laravel/Serializable-Closure (v1.3.0): Extracting Archive - Installing Doctrine/Inflector (2.0.6): Extracting Archive - Installing Laravel/Framework (v8.83.27): Extracting Archive - Installing Facade/Ignition-Contracts (1.0.2): Extracting Archive - Installing facade/flare-client-php (1.10.0): Extracting Archive - Installing Facade/Ignition (2.17.7): Extracting Archive - Installing FakerPHP/Faker (v1.22.0): Extracting Archive - Installing Fideloper/Proxy (4.4.2): Extracting Archive - Installing fruitcake/php-cors (v1.2.0): Extracting Archive - Installing fruitcake/Laravel-cors (v3.0.0): Extracting Archive - Installing GuzzleHttp/Promises (2.0.0): Extracting Archive - Installing symfony/YAML (v6.3.0): Extracting Archive - Installing Laravel/Sail (v1.22.0): Extracting Archive - Installing Nikic/PHP-Parser (v4.15.5): Extracting Archive - Installing PSY/PSYSH (v0.11.18): Extracting Archive - Installing Laravel/Tinker (v2.8.1): Extracting Archive - Installing Hamcrest/Hamcrest-php (v2.0.1): Extracting Archive - Installing mockery/mockery (1.6.1): Extracting Archive - Installing FILP/WHOOPS (2.15.2): Extracting Archive - Installing NUNOMADURO/COLLISION (v5.11.0): Extracting Archive - Installing Sebastian/Version (3.0.2): Extracting Archive - Installing Sebastian/Type (3.2.1): Extracting Archive - Installing Sebastian/Resource-Operations (3.0.3): Extracting Archive - Installing Sebastian/Recursion-Context (4.0.5): Extracting Archive - Installing Sebastian/Object-Reflector (2.0.4): Extracting Archive - Installing Sebastian/Object-Enumerator (4.0.4): Extracting Archive - Installing Sebastian/Global-State (5.0.5): Extracting Archive - Installing Sebastian/Exporter (4.0.5): Extracting Archive - Installing Sebastian/Environment (5.1.5): Extracting Archive - Installing Sebastian/Diff (4.0.5): Extracting Archive - Installing Sebastian/Comparator (4.0.8): Extracting Archive - Installing Sebastian/Code-Unit (1.0.8): Extracting Archive - Installing sebastian/cli-parser (1.0.1): Extracting Archive - Installing phpunit/php-timer (5.0.3): Extracting Archive -Installing phpunit/php-text-template (2.0.4): extracting archive - Installing phpunit/php-invoker (3.1.1): Extracting Archive - Installing phpunit/php-file-iterator (3.0.6): extracting archive - Installing theseer/Tokenizer (1.2.1): Extracting Archive - Installing Sebastian/Lines-of-Code (1.0.3): Extracting Archive - Installing Sebastian/Complexity (2.0.2): Extracting Archive - Installing sebastian/code-unit-reverse-lookup (2.0.3): Extracting Archive - Installing phpunit/php-code-coverage (9.2.26): extracting archive - Installing Phar-IO/Version (3.2.1): Extracting Archive - Installing Phar-io/Manifest (2.0.3): Extracting Archive - Installing myclabs/deep-copy (1.11.1): extracting archive - Installing Doctrine/Instantiator (2.0.0): Extracting Archive - Installing phpunit/phpunit (9.6.8): Extracting Archive - Installing PSR/Http-Message (1.1): Extracting Archive - Installing PSR/HTTP-Factory (1.0.2): Extracting Archive - Installing Ralouchie/GetAllHeaders (3.0.3): Extracting Archive - Installing PSR/Http-Client (1.0.2): Extracting Archive - Installing GuzzleHttp/PSR7 (2.5.0): Extracting Archive - Installing guzzlehttp/guzzle (7.7.0): Extracting Archive - Installing firebase/php-jwt (v6.5.0): Extracting Archive - Installing Shopify/Shopify-API (v5.0.0): Extracting Archive -Installing squizlabs/php_codesniffer (3.7.2): Extracting Archive Package fruitcake/Laravel-cors is abandoned, you should avoid using it. No replacement was suggested. Package SwiftMailer/SwiftMailer is bandoned, you should avoid using it. Use symfony/mailer instead. GENERATING OPTIMIZED AUTOLOAD FILES > Illuminate\Foundation\ComposerScripts::PostAutoLoadDump > @php artisan package:discover --ansi In process.php line 146: The process class relies on proc_open, which is not available on your php installation. install[--prefer-source][--prefer-dist][--prefer-install PREFER-INSTALL][--dry-run][--download-only][--dev][--no-suggest][--no-dev][--no-autoloader][--no-progress][--no-install][--audit][--audit-format AUDIT-FORMAT][-v|vv|vvv|--verbose][-o|--optimize-autoloader][-a|--classmap-authoritative][--apcu-autoloader][--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX][--ignore-platform-req IGNORE-PLATFORM-REQ][--ignore-platform-reqs][--][<packages>...]
18. Reference:The process class relies on proc_open, which is not available on your php installation. . Edit /usr/local/php/etc/php.ini, delete proc_open, proc_get_status in disable_functions
disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_al ter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen [root@iZ23wv7v5ggZ php]# service php-fpm restart redirecting to /bin/systemctl restart php-fpm.service [root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# composer install Installing dependencies from lock file (inclusion require-dev) Verifying lock file contents can be installed on current platform. Nothing to install, update or remove Package fruitcake/Laravel-cors is abandoned, you should avoid using it. No replacement was suggested. Package SwiftMailer/SwiftMailer is bandoned, you should avoid using it. Use symfony/mailer instead. GENERATING OPTIMIZED AUTOLOAD FILES > Illuminate\Foundation\ComposerScripts::PostAutoLoadDump > @php artisan package:discover --ansi Discovered Package: Facade/Ignition Discovered Package: FideLoper/Proxy Discovered Package: Fruitcake/Laravel-Cors Discovered Package: Laravel/Sail Discovered Package: Laravel/Tinker Discovered Package: Nesbot/Carbon Discovered Package: NUNOMADURO/COLLISION Package manifested successfully. 81 packages you are using are looking for funding. Use the `Composer Fund` command to find out more!
19. Failed to execute database migration, error: sqlstate[42000]: Syntax Error or Access Violation: 1071 specific key was too long; max key length is 767 bytes
[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# php artisan migrate
***************************************
* Application in production! *
***************************************
Do you really wish to run this command?[no]:
> yes
Migration Table Created Successfully.
Migrating: 2019_08_19_000000_create_failed_jobs_table
ILUMINATE\Database\QueryException
sqlstate[42000]: Syntax error or access Violation: 1071 specific key was too long; max key length is 767 bytes (SQL: ALTER table `failed_jobs` add unique `failed_jobs_uuid_unique`(`uuid`))
at vendor/laravel/framework/src/illuminate/database/connection.php:712
708▕ // If an exception occurred when attempting to run a query, weLL format the error
709▕ // Message to include the bindings with SQL, which will make this exception A
710▕ // Lot more helpful to the developer instead of just the databases errors.
711▕ catch (exception $e) {
➜ 712▕ Throw New QueryException(
713▕ $Query, $this->preparebindings($bindings), $E
714▕ );
715▕ }
716▕ }
+9 vendor frames
10 database/migrations/2019_08_19_000000_create_failed_jobs_table.php:24
IlluMinate\Support\Facades\Facade::__CallStatic()
+22 vendor frames
33 Artisan: 37
IlluMinate\Foundation\Console\Kernel::Handle()
20. Reference:Parameter configuration of Alibaba Cloud RDS, enable InnoDB_Large_Prefix . Edit config/database.php, modifyEngine=>null, forEngine=>innodb,. Execute the database migration again and report an error. sqlstate[42S01]: base table or view already EXISTS: 1050 tablefailed_jobsALREADY EXISTS. After deleting all tables in the database, the migration is re-execute. No more errors.
[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# php artisan migrate *************************************** * Application in production! * *************************************** Do you really wish to run this command?[no]: > yes Migration Table Created Successfully. Migrating: 2019_08_19_000000_create_failed_jobs_table Migrated: 2019_08_19_000000_Create_failed_jobs_table (13.03ms) Migrating: 2021_05_03_050717_create_sessions_table migrated: 2021_05_03_050717_create_sessions_table (11.62ms) Migrating: 2021_05_05_071311_add_scope_expires_access_token_to_sessions migrated: 2021_05_05_071311_add_scope_expires_access_token_to_sessions (9.72ms) Migrating: 2021_05_11_151158_add_online_access_info_to_sessions migrated: 2021_05_11_151158_add_online_access_info_to_sessions (9.32ms) Migrating: 2021_05_17_152611_change_sessions_user_id_type migrated: 2021_05_17_152611_change_sessions_user_id_type (48.28ms)
21. Build the backend.
[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# composer build > composer build-frontend-links > ln -sf ../frontend/dist/assets public/assets && ln -sf ../frontend/dist/index.html public/index.html
22. Visit the application homepage: https://learn-php-app-0605-prod.shuijingwanwq.com/ . Response 403. as shown in Figure 6
23. View the virtual host configuration file
[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# cat /usr/local/nginx/conf/vhost/learn-php-app-0605-prod.shuijingwanwq.com.conf
server {
listen 80;
listen[::]:80;
Listen 443 SSL HTTP2;
listen[::]:443 SSL HTTP2;
ssl_certificate /usr/local/nginx/conf/ssl/learn-php-app-0605-prod.shuijingwanwq.com.crt;
ssl_certificate_key /usr/local/nginx/conf/ssl/learn-php-app-0605-prod.shuijingwanwq.com.
SSL_Protocols TLSv1.2 TLSv1.3;
SSL_ECDH_Curve x25519:prime256v1:secp384r1:secp521r1;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384: ECDHE-RSA-AES256-GCM-SHA38 4: ecdhe-ecdsa-chacha20-poly1305: ecdhe-rsa-chacha20-poly13 05: ECDHE-ECDSA-AES128-GCM-SHA256: ECDHE-RSA-AES128-GCM-SH A256: DHE-RSA-AES256-GCM-SHA384: DHE-RSA-AES128-GCM-SHA256;
SSL_CONF_Command CipherSuites TLS_AES_256_GCM_SHA384:TLS_CHACHA20_Poly1305_SHA256:TLS_AES_128_GCM_SHA256;
SSL_CONF_Command options prioritizechacha;
ssl_prefer_server_ciphers on;
SSL_Session_Timeout 10M;
ssl_session_cache shared:ssl:10m;
SSL_Buffer_size 2K;
add_header strict-transport-security max-age=15768000;
SSL_Stapling on;
SSL_StapLing_Verify on;
server_name learn-php-app-0605-prod.shuijingwanwq.com;
access_log /data/wwwlogs/learn-php-0605-prod.shuijingwanwq.com_nginx.log combined;
index index.html index.htm index.php;
root /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com;
if ($ssl_protocol = "") { return 301 https://$host$request_uri; }
include /usr/local/nginx/conf/rewrite/laravel.conf;
#error_page 404 /404.html;
#error_page 502 /502.html;
location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv|mp4)$ {
valid_referers none blocked *.shuijingwanwq.com learn-php-app-0605-prod.shuijingwanwq.com;
if ($invalid_referer) {
return 403;
}
}
location ~[^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
Expires 30D;
access_log off;
}
location ~ .*\.(js|css)?$ {
Expires 7D;
access_log off;
}
location ~ /(\.user\.ini|\.ht|\.git|\.svn|\.project|license|readme\.md) {
deny all;
}
location /.well-known {
allow all;
}
}
[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# ^c
[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# cat /usr/local/nginx/conf/rewrite/laravel.conf
location / {
try_files $uri $uri//index.php?$query_string;
}
[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]#
24. Reference nginx.conf in the template, its content is as follows
user www-data www-data;
events {
worker_connections 1024;
}
http {
index index.php index.html;
upstream php {
Server 127.0.0.1:9000;
}
server {
include /etc/nginx/mime.types;
include /etc/nginx/default.d/*.conf;
listen port;
server_name 0.0.0.0;
root /app/public;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~[^/]\.php(/|$) {
include /etc/nginx/fastcgi_params;
try_files $uri $uri//index.php?$uri;
fastcgi_param script_filename $document_root$fastcgi_script_name;
fastcgi_param path_info $fastcgi_path_info;
fastcgi_param path_translated $document_root$fastcgi_path_info;
fastcgi_pass php;
fastcgi_index index.php;
}
}
}
25. Edit /usr/local/nginx/conf/vhost/learn-php-app-0605-prod.shuijingwanwq.com.conf
index index.php index.html; root /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com/public;
26. Response 500, enable debug, edit .env. Error: TypeError
Shopify\utils::SanitizeShopDomain(): Argument #1 ($shop) must be of type string, null given, called in /data/wwwroot/learn-php-0605-prod.shuijingwanwq.com/app/lib/authredirection.php on line 17 . Ignore it, it’s in line with expectations. as shown in Figure 7
app_env=local app_debug=true
27. Update the URL in the partner dashboard. as shown in Figure 8
28. In the partner dashboard, go to the overview page of the application. In the Test Your Apps section, click Select Store and then select a store to test the app. as shown in Figure 9
29. When installing the application, an error is reported: ops, something went wrong. . The reason should be that the request parameter is incorrect. As shown in Figure 10
client_id: not_defined Scope: not_defined redirect_uri: https://not_defined/api/auth/callback STATE: B27BE356-0010-43AE-B3B8-90A337314C0C GRANT_OPTIONS[]:
30. Edit .env, refer to .env.testing
app_name="shopify php app 0605 prod" app_env=production app_key=base64:tpbljwcisyl3z/hs+oqs2gxvmpb0a7glvnv6ifwfg6a= app_debug=false app_url=https://learn-php-app-0605-prod.shuijingwanwq.com Shopify_API_KEY=C7F826670575F7AE069F7E56350465EF Shopify_API_Secret=4DE64AA8281E97055CF7698BBE56039E Scopes=write_products host=learn-php-app-0605-prod.shuijingwanwq.com log_channel=stack log_level=debug db_connection=mysql DB_HOST=*************** DB_PORT=3306 db_database=learn_php_app_0605_prod db_username=learn_php_app_0605_prod db_password=**********
31. No more errors. as shown in Figure 11
32. After clicking the installation application, enter the store background, but the page preview is blank. as shown in Figure 12
33. After rebuilding the front-end and back-end, uninstall the application. as shown in Figure 13
34. Install again, refresh the page, the page is no longer blank, in line with expectations. Figure 14













