Learn how to create an Installer of your PHP Project

PHP Web Application create Installer scripts

Today, We want to share with you PHP Web Application create Installer scripts.In this post we will show you , hear for php project install script we will give you demo and example for implement.In this post, we will learn about How To Create User-Friendly PHP Script Installation with an example.

PHP Web Application create Installer scripts

There are the Following The simple About PHP Web Application create Installer scripts Full Information With Example and source code.

As I will cover this Post with live Working example to develop PHP Installer: Create PHP application install scripts, so the some major files and Directory structures for this example is following below.

Connecting to MySQL with PHP

database-app ->data(folder) -->init.sql ->public -->css --->style.css ->templates -->footer.php -->header.php ->common.php ->config.php ->intall.php

database-app/data/init.sql

CREATE DATABASE memberlist; use memberlist; CREATE TABLE members ( id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY, memberfname VARCHAR(30) NOT NULL, memberlname VARCHAR(30) NOT NULL, membermail VARCHAR(50) NOT NULL, memberage INT(3), membercity VARCHAR(50), date TIMESTAMP );
exec($sql); echo "Database and table members created successfully."; > catch(PDOException $error) < echo $sql . "
" . $error->getMessage(); >

database-app/public/index.php

database-app/public/create.php

 $_POST['memberfname'], "memberlname" => $_POST['memberlname'], "membermail" => $_POST['membermail'], "memberage" => $_POST['memberage'], "membercity" => $_POST['membercity'] ); $sql = sprintf( "INSERT INTO %s (%s) values (%s)", "members", implode(", ", array_keys($new_member)), ":" . implode(", :", array_keys($new_member)) ); $mystmt = $connection->prepare($sql); $mystmt->execute($new_member); > catch(PDOException $error) < echo $sql . "
" . $error->getMessage(); > > ?>
successfully added.
?>

Add a Member

Member Sir Name Email of Member Member Age City Back to home

database-app/public/templates/footer.php

PHP Installer Create PHP application install scripts

database-app/public/templates/header.php

        

PHP Web Application Installer scripts

database-app/public/css/style.css

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

I hope you get an idea about PHP Web Application create Installer scripts.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Источник

How to create an install installation file-PHP Tutorial

How do I create an install installation file. After the dream program is completed, if you want to send it to someone else, you need to extract the Database SQL file and modify the database connection. in this case, the customer’s operations are not very user-friendly, for example, after the Dream program is completed, if you want to send it to someone else, you need to extract the Database SQL file and modify the database connection. in such a few steps, the customer’s operations are not very user-friendly, the following describes how to make it easier to install a website:

Читайте также:  Typescript cast to class

1. open the install folder and perform the following four steps:

1、delete index.html
2. change index. php. bak to index. php.
3rd delete the install_lock.txt file
4. change module-install.php.bak to module-install.php
2. Next, this is the focus. you need to export your database files. in this way, you can install your database directly for user operations, saving a lot of trouble.

There are sql-dfdata.txt and sql-dftables.txt files under the install folder

The sql-dfdata.txt file is the data insertion file

The sql-dftables.txt is used to create data tables and field files

The next step is to export your database.

1. open phpmyadmin and select Zhimeng database, select export, and perform the following operations (for example)

Click to copy the exported data warehouse information to the sql-dftables.txt File (this file is used to create data tables and fields)

2. the next step is to export the data information, that is, the insert statement.

Then, save the imported data to the sql-dfdata.txt file.

Now, you can send your dream to your customers, upload it to the space, and directly execute http: // domain name/install/fill in the database information to install it.

This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or complaint, to info-contact@alibabacloud.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.

Источник

Скачать Урок по созданию install.php

Урок по созданию install.php

Не видел не одного примера создание install.php в примерах и решил написать 🙂 Я не журналист и по тому не мастер в описаниях , все что смогу обьясню! (PS: это установка Kooal Free Game (_kooalfree.ru)

Пример что у вас получиться :

Начнем с самого простого 🙂 Это оформление установщика используем CSS

body < /* Общий стиль страницы */ background: #101010; /* Цвет фона */ > a < /* оформление тэг "a" */ color: #fff;/* Цвет */ > h5 < /* оформение тэга "h5" */ font: 16px Arial, Verdana, Tahoma, sans-serif; /* Настройка шрифта */ color: #fff; /* Цвет шрифта */ margin: 0 auto 40px; padding: 0; text-align: center; /* Размещение по центру */ width: 80%; /* Ширина */ > h6 < /* Оформление тэга "р6" */ font: 12px Arial, Verdana, Tahoma, sans-serif; /* Настройка шрифта */ color: #fff; /* Цвет шрифта */ margin: 0 auto 40px; padding: 0; text-align: center; /* Размещение по центру */ width: 80%;/* Ширина */ > h2 /* Оформление тэга "р2" */ font: 28px tahoma, verdana, arial, sans-serif;/* Настройка шрифта */ font-weight: bold; color: #84e03a;/* Цвет шрифта */ margin: 0; padding: 0 0 10px 0; > div < /* Оформление БЛОГа */ border: 2px solid #1d1d1d; padding: 10px; font: 12px Verdana, Tahoma, Arial, sans-serif;/* Шрифт */ width: 600px;/* Ширина*/ margin: 10px auto; color: #fff;/* цвет */ > /* Далее все по примеру выше :) Все просто учим CSS если не понятно что то */ label, input < font: 14px Verdana, Tahoma, Arial, sans-serif; >label < display: block; width: 100px; float: left; color: #fff; >input < border: 0; padding: 2px; >input#install < display: block; background-color: #101010; color: #84e03a; font: 32px Verdana, Tahoma, Arial, sans-serif; margin: 0 auto; text-decoration: underline; >input#username, input#password, input#email, label < margin-top: 10px; >input#username < clear: right; >div.error < color: #ff0000; text-align: center; >div.success

Как видите все очень просто! (обычное оформление CSS), быть мастером не надо чтоб оформить installer , главное фантазия 🙂

Читайте также:  Counting integers in python

Далее создадим install.php

И делаем все по шагам
Шаг 1 — создаем шапку

         

Далее проверка существует ли файл конфигурации , если скрипт обнаружит config.php в указаной вами дирриктории то попросит удалить его чтоб продолжить! (если конфигураций нет скрипт продолжит установку)
*Это не обязательно для установщика , но решил сделать 🙂

 //Если файл конфигураций пресуцтвует то просим его удалить :D $filename = 'conf/config.php';/* Папка/Файл.php */ if (file_exists($filename)) < print "

Ошибка

Для того что бы продолжить установку удалите $filename и обновите страницу.
"; > else < ?>

Создаем блоги (О скрипте / Конфигурации / Соглашение)

  
Лого
php if(!$_GET['go']) < ?> true">

О скрипте

Текст в блоге

Конфигурации

Название скрипта=Sitename?>>
Хост=Localhost?>>
Логин=mysql_user?>>
Пароль
База=my_database?> >
Префикс=KFG_?> >

Лицензия

Я согласен

Для чего нужны конфигурации? — Для создания config.php чтобы в дальнейшем подключиться к DB и залить базу в MySQL 🙂 ( О том как создавать дополнительные поля расскажу позже)

Переходим к самому большому шагу 🙂 это создание файлов и заливание в базу 🙂

php > else < ?> 

Установка.

echo 'Файл config.php '; $fp = fopen ("conf/config.php","w"); //Желательно не менять , но если заменили то ниже там где заполнение бд укажите путь к конфигу flock($f,LOCK_EX); fputs($fp,"php\n\r"); fputs($fp,'$sitename = '."'".$_POST['sitename']."';\n\r"); fputs($fp,'$mysql_host = '."'".$_POST['mysql_host']."';\n\r"); fputs($fp,'$mysql_user = '."'".$_POST['mysql_user']."';\n\r"); fputs($fp,'$mysql_password = '."'".$_POST['mysql_password']."';\n\r"); fputs($fp,'$my_database = '."'".$_POST['my_database']."';\n\r"); fputs($fp,'$SQL_PREFIX = '."'".$_POST['SQL_PREFIX']."';\n\r"); fputs($fp,"?>\n\r"); flock($f,LOCK_UN); fclose($fp); echo 'создан'; // Создадим файл .htaccess и укажем в нем // что по умолчанию нужно открывать файл index.php echo 'Файл .htaccess '; $f=fopen('.htaccess','w'); flock($f,LOCK_EX); fputs($f,"DirectoryIndex index.php\n"); flock($f,LOCK_UN); fclose($f); echo 'создан';

Думаю с созданием файлов все ясно 🙂 Теперь к базам!

require 'conf/config.php'; //путь к конфигу указаному при создании файла $link = mysql_connect($mysql_host , $mysql_user, $mysql_password ); //конектимся к DB mysql_select_db($my_database); //Начинаем заполнять базы $table_messages = 'CREATE TABLE `'.$SQL_PREFIX.'Название базы` ( `recipient` text, `sender` text, `message` text, `type` text, `stamp` text, `id` bigint(20) unsigned NOT NULL auto_increment, UNIQUE KEY `id` (`id`) );'; if(!mysql_query($table_messages)) < if(mysql_errno() == 1050) < print "Table '".$SQL_PREFIX."messages' уже существует! Удалите ее или смените префикс базы.

\n"; $problem = true; > else < print("A MySQL error occured: (" . mysql_errno() . ") " . mysql_error() . "

\n"); $error = true; > > else < mysql_query('ALTER TABLE `'.SQL_PREFIX.'messages` CHANGE `message` `message` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL'); print "Table '".SQL_PREFIX."testbase' added successfully!

\n"; > if ($maxBuddyIconSize > 0) < if (trim(substr(sprintf('%o', fileperms('./buddyicons/')), -4)) != 777) < $error = true; print "Права::

CHMOD buddyicons/ to 0777

"; > else < print "Вы должны иметь права доступа!/

"; > > mysql_close(); ?>

Далее завершающие шаги установки это проверка файлов и папок на сервере (для коректной работы должны быть все!)

 

Проверка файлов.

Файлы $filename = 'conf/config.php'; //Путь и файл который проверяем if (file_exists($filename)) < print "Файл $filename существует"; //Если найден > else < print "Файл $filename // Если не найден НЕ существует"; > Echo ''; $filename = 'conf/function.php';//Путь и файл который проверяем if (file_exists($filename)) < print "Файл $filename существует"; //Если найден > else < print "Файл $filename // Если не найден НЕ существует"; > Echo ''; ?>
Папки
php $catname = 'conf'; //Название папки if (is_dir("$catname")) < print "Папка $catname существует"; //Если найдена > else < print "Файл $catname // Если не найден НЕ существует"; > Echo ''; $catname = 'scripts'; // название папки if (is_dir("$catname")) < print "Папка $catname существует"; //Если найдена > else < print "Файл $catname // Если не найден НЕ существует"; > Echo ''; ?>

Теперь завершающий шаг вывод об окончании установки 🙂 (или ошибка или успешно!)

class="php if($error) print 'error'; else print 'success'; ?>">

Установка окончена!

php if($error) print 'Ошибка при установки!'; else print 'Установка движка окончена! главная Админ центр'; ?>
php > ?> php > ?>

Если чтото комуто не ясно пишите если что поясню 🙂 (пример рабочего скрипта : _kooaltest.org.ru/installer/install.php )

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Compress and create php installer

License

feulf/phpinstaller

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README

Create installer in a single install.php file. It compress all the selected files and directories in a single PHP file. The install.php file contains an installer script to deflate all the contents archived and it can also install the database archived.

About

Compress and create php installer

Источник

Оцените статью