Packaging method of php project

不言
Release: 2023-03-23 09:24:01
Original
16757 people have browsed it

php project packaging method

We often receive some programming tasks, such as designing corporate websites, doing financial and statistical systems, etc. Maybe it's because of the needs of friends, or maybe it's just for pocket money. Whatever the reason. Once the program is ready, showing it to the other party and installing it becomes a problem. Corporate websites are easy to say, at least they need a virtual host or something; but OA, finance... these internal systems are hard to say. You can't just throw the code and database to others, write a description, and let them configure the environment according to the instructions. Install the code. This is obviously outrageous. You must know that every other line is like a mountain! Furthermore, if the customer is thousands of miles away from where he or she lives, he can't go there and have someone install it. In this case, all the income will probably not be able to cover the cost of the trip. Therefore, it is necessary to package the WAMP environment + PHP program + maintenance installation and uninstallation program into an EXE installation package. Let customers install PHP programs as easy and convenient as installing QQ!

There should be many kinds of methods. There are only three I know of.

1. Use RAR’s automatic decompression function.

2. Use Windows packaging software InstallShield to create an installation package.

3. Pack with ready-made items! (Haha, as the saying goes, stand on the shoulders of giants! I am also a lazy person.)

As for the above 1.2 method, you can search it through Baidu and Google. I'm not too lazy to search...=.=! Better than me...

Here I will explain my method in detail. This method was also collected by me when I helped a friend build a real estate information system a few days ago.

First, you need a pure and green PHP operating environment. Components are configured first according to project requirements. I use F:\PHPServer as the root directory of the environment. The general components apache2+php5+mysql5+zo need to open the GD library... configure 80, 3306... everyone should be familiar with this than me. It is best to use a highly customizable integrated suite, preferably a green version in ZIP format, such as PHPNOW and XAMPP. Don't worry, the download link will be written below. I use PHPnow, which is compact, convenient and highly customizable!

Second, install our compiled system, check and debug by yourself, and everything is OK. Okay, that's half done. At this time, someone spoke up, "charlatan", "Mongolian doctor" and "liar". kindness! Don't be impatient, the fun is coming! Now in this folder PHPServer, we must ensure that no configuration files are imported from the outside world. We must ensure the independence and integrity of PHPServer, that is, ensure that it is green.

Third, these green integration suites generally have written BAT, which is a batch file, and you can start and shut down the service by directly entering the number. At this time, we can use RAR self-extraction + run batch processing, which is fine, but now it is blocked by many anti-virus software. In fact, I also use this principle. I found a packaging program make_exe (from PHPnow) on the Internet that can package the .7z+ file interface information into an EXE running package, and automatically run the batch file in the 7z compressed package after running the self-extraction. The make_exe.zip package contains three files: Make_exe.cmd, PHPServer.sfx, and PHPServer.sfx.cf. Seeing this, everyone should have an idea. First, compress PHPServer into PHPServer.7z file and then configure it. Just modify the PHPServer.sfx.cf file and run Make_exe.cmd.

First: Make_exe.cmd code
set v=1.2
copy /b /y PHPServer.sfx + PHPServer.sfx.cf + *.* PHPServer%v%.exe || pause
It’s very clear! "set v=1.2" is the version, and then three files are needed for packaging.
PHPServer.sfx.cf code, open the method and drag it directly to TXT

;!@Install@!UTF-8!
Title="Real Estate Information Management System V1.2"
BeginPrompt="# Real Estate Information Management System V1.2 Installation Package #\n\n * Make sure you are not running IIS or other services that occupy port 80.\n * If you have other similar packages installed, please stop or uninstall them first . \n * Please do not move the installation directory casually after the installation is completed \n\nAuthor: xilo QQ: 110026985 Home page http://www. xilo.cn. "
ExtractDialogText="Please wait, the file is being decompressed..."
ExtractTitle="Extracting..."
ExtractPathText="Please select the decompression path ( English characters only):"
ExtractCancelText="Cancel"
CancelPrompt="Do you really want to exit?"
GUIFlags="4+8+32+64+256+2048"
InstallPath="D:\\PHPServer"
RunProgram="cmd /c setup.cmd"
;!@InstallEnd@!
I believe I don’t need to explain these, you can change whatever you want to display. Note that InstallPath="D:\\PHPServer" is the installation directory, and after decompression, run RunProgram="cmd /c setup.cmd" BAT, which is the command to start apache and mysql services. The following is the command of PHPServer's setup.cmd. Because there are too many, just post a few sentences!


@echo off
rem -- http://www.xilo.cn
rem -- By xilo (QQ:110026985)
setlocal enableextensions
call Pn\config.cmd
prompt -$g
title Initialize PHPserver %pnver% - Apache + PHP + MySQL
echo ____________________________________________________________
echo ^|                   ^|
echo ^|

Installing Haobo Real Estate Information Management System Environment Suite

^|
echo ^|______________________________________________________________^|
echo.

:copy
echo ____________________________________________________________
echo ^|                                                                ^|
echo.
rem Create directory
if not exist %apadir%\conf\extra md %apadir%\conf\extra
if not exist %apadir%\logs md %apadir%\logs
Omit…………
Omit…………
All files will be attached below ! The simple explanation is to configure, copy, and start! If you don’t understand, I’ll explain it downstairs.
Pictures:
Step one:

Step two:



Step three:




Actually, it’s OK. I believe everyone understands that posting a technical post for the first time is a bit too Tang Seng! Haha! If it is perfected, it will be the uninstall command! Back up the database! Add it to STARTMENU! It's all very simple! One final statement: all resources come from the Internet. I hope the software authors will not cause trouble for me!
Post link! ! !
1.PHPnow official
2.Make_EXE.zip

3.Streamlined setup.cmd

4.7z is very powerful!

Related recommendations:

PHP project version control and release process - CSDN blog

Instances of IIS server deployment of php projects share

#########

The above is the detailed content of Packaging method of php project. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!