- Работа с PHP-скриптами в командной строке
- Как запустить скрипт под определённой версией PHP
- Популярные статьи
- yrkup3/php-opt-cli
- Project Statistics
- Top Contributors See all
- Packages Referencing this Repo
- Recent Tags See all
- asharirfan / freemius-opt-in-out.php
- Saved searches
- Use saved searches to filter your results more quickly
- License
- clickatell/sms-opt-in-and-out-tutorial
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
Работа с PHP-скриптами в командной строке
Перед началом работы подключитесь к серверу по SSH.
По умолчанию скрипты запускаются под версией PHP 5.4 (системной сборкой). Пример:
Поэтому команда php –v выдает информацию о системной сборке PHP, а не о версии, установленной в панели управления хостингом:
Доступные сборки PHP находятся в папке /opt/php. Посмотреть их можно с помощью команды ls /opt/php:
Как запустить скрипт под определённой версией PHP
Важно! Скрипты можно запускать через PHP и PHP-CGI. Информацию о том, какой режим работы подходит для вашего проекта, необходимо уточнять у разработчиков.
Примеры:
– /opt/php/7.0/bin/php — путь до обработчика в режиме PHP,
– /opt/php/7.0/bin/php-cgi — путь до обработчика в режиме PHP-CGI.
Для запуска скрипта под определенной версией PHP необходимо выполнить команду:
/opt/php/версия_php/bin/php www/mysite.ru/script.php
Где:
– /opt/php/версия_php/bin/php — путь до обработчика,
– www/mysite.ru/script.php — путь до скрипта.
Допустим, нам нужно запустить скрипт www/test2d.ru/info.php под версией PHP 8.1. Для этого выполним команду:
/opt/php/8.1/bin/php www/test2d.ru/info.php
Где:
– /opt/php/8.1/bin/php — путь до обработчика,
– www/test2d.ru/info.php — путь до скрипта.
Вывод команды показывает, что скрипт запустился под версией PHP 8.1:
Аналогично можно запустить скрипт под любой другой доступной сборкой PHP. Список доступных сборок:
– /opt/php/5.1/bin/php
– /opt/php/5.2/bin/php
– /opt/php/5.3/bin/php
– /opt/php/5.3-bx-optimized/bin/php
– /opt/php/5.3-with-xcache/bin/php
– /opt/php/5.4/bin/php
– /opt/php/5.4-bx-optimized/bin/php
– /opt/php/5.4-bx-optimized2/bin/php
– /opt/php/5.4-with-xcache/bin/php
– /opt/php/5.5/bin/php
– /opt/php/5.5-bx-optimized/bin/php
– /opt/php/5.6/bin/php
– /opt/php/5.6-bx-optimized/bin/php
– /opt/php/7.0/bin/php
– /opt/php/7.0-bx-optimized/bin/php
– /opt/php/7.1/bin/php
– /opt/php/7.1-bx-optimized/bin/php
– /opt/php/7.2-bx-optimized/bin/php
– /opt/php/7.2/bin/php
– /opt/php/7.2-umi/bin/php
– /opt/php/7.3-bx-optimized/bin/php
– /opt/php/7.3/bin/php
– /opt/php/7.4-bx-optimized/bin/php
– /opt/php/7.4/bin/php
– /opt/php/8.0/bin/php
– /opt/php/8.1/bin/php
Узнать подробную информацию о сборке PHP можно с помощью команды:
Узнать список доступных модулей можно с помощью команды:
Популярные статьи
- Как указать (изменить) DNS-серверы для домена
- Я зарегистрировал домен, что дальше
- Как добавить запись типа A, AAAA, CNAME, MX, TXT, SRV для своего домена
- Что такое редирект: виды и возможности настройки
- Как создать почту со своим доменом
yrkup3/php-opt-cli
Execute CLI Statements based upon Opt-In / Opt-Out Rules.
Execute CLI Statements based upon opt-in / out-out Rules.
This project is a PHP implementation of opt-cli project. Almost any behaviour of the oriiginal project is compatible.
Simply install locally as a development dependency to your composer package:
composer require --dev yrkup3/opt-cli-php
Opting in/out of a configured tasks, best use case is for BrainMaestro/composer-git-hooks. More
"extra": < "hooks": < "pre-commit": "opt --in pre-commit --exec 'composer run test'" > >,
While commit ing, composer run test will not be executed by default. However, one can opt in by creating a .opt-in file in the root of the project, with the content pre-commit
Each line in the .opt-in file, is the keyword used after the opt —in rule.
So for the above example, it’s pre-commit
opt —out works exactly, the opposite way of opt —in .
"extra": < "hooks": < "pre-commit": "opt --out pre-commit --exec 'composer run test'" > >,
In this case, composer run test will be executed before any changes can be commit ed. In order to opt out, you have to create a .opt-out file in the root of the project, with the content pre-commit
Similar to .opt-in file, each line in .opt-out file, is the keyword used after the opt —out rule.
So for the above example, it’s pre-commit
- don’t forget to update .gitignore to ignore this file.
- opt-in , opt-out files can contain multiple rules
- every line must contain only a single rule.
- # can be used to comment any rule.
Rules to opt-into or opt-out of can also be specified using .
"config": < "opt": < "in": [ "pre-commit" ], "out": [ "pre-push" ] > >,
# Delimit multiple rules with ":" on *nix and ";" on Win export OPT_IN="pre-commit" export OPT_OUT="pre-push"
Project Statistics
Sourcerank | 3 |
Repository Size | 23.4 KB |
Stars | 1 |
Forks | 0 |
Watchers | 1 |
Open issues | 0 |
Dependencies | 8 |
Contributors | 1 |
Tags | 6 |
Created | Sep 11, 2017 |
Last updated | Sep 16, 2017 |
Last pushed | Sep 16, 2017 |
Top Contributors See all
Packages Referencing this Repo
yrkup3/php-opt-cli
yrkup3/opt-cli-php
Recent Tags See all
1.1.0 | September 16, 2017 |
1.0.4 | September 11, 2017 |
1.0.3 | September 11, 2017 |
1.0.2 | September 11, 2017 |
1.0.1 | September 11, 2017 |
1.0.0 | September 11, 2017 |
Something wrong with this page? Make a suggestion
Last synced: 2017-09-11 06:11:00 UTC
Login to resync this repository
Libraries.io helps you find new open source packages, modules and frameworks and keep track of ones you depend upon.
Copyright © 2023 Tidelift, Inc
Code is Open Source under AGPLv3 license
Data is available under CC-BY-SA 4.0 license
asharirfan / freemius-opt-in-out.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
// $choice contains the user’s input to opt-in or out. |
if ( ‘yes’ === $ choice ) |
if ( ! is_multisite() ) |
my_freemius()-> opt_in (); // Opt in. |
> else |
// Get all sites on the WP multisite network. |
$ sites = Freemius :: get_sites (); |
$ sites_data = array (); |
if ( ! empty( $ sites ) ) |
foreach ( $ sites as $ site ) |
$ sites_data [] = my_freemius()-> get_site_info ( $ site ); // Get site info from Freemius. |
> |
> |
my_freemius()-> opt_in ( false , false , false , false , false , false , false , false , $ sites_data ); // Opt-in with all sites data. |
> |
> elseif ( ‘no’ === $ choice ) |
if ( ! is_multisite() ) |
my_freemius()-> skip_connection (); // Opt out. |
> else |
my_freemius()-> skip_connection ( null , true ); // Opt out for all websites on multisite. |
> |
> |
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.
A simple Symfony tutorial on using Clickatell’s API to have your user opt in and out of SMS marketing/notifications.
License
clickatell/sms-opt-in-and-out-tutorial
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.md
Building a SMS opt in and opt out system in Symfony
Welcome to a simple Symfony tutorial on using Clickatell’s API to have your user opt in and out of SMS marketing/notifications.
First step is to create a new Symfony project – here I used the composer method.
$ composer create-project symfony/framework-standard-edition sms_opt_in_and_out
We’ll also need the Clickatell php library installed into the project — easy with composer.
$ o composer require arcturial/clickatell
Next you’ll need to create a bundle to do your work in, I called mine Clickatell/SMSOptInAndOutBundle with ClickatellSMSOptInAndOutBundle as the «short» hand name — Just follow the steps prompted.
$ php app/console generate:bundle --namespace=Clickatell/SMSOptInAndOutBundle
First add the bundles to the AppKernal — our own and the Clickatell one.
$bundles = array( new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new AppBundle\AppBundle(), // Our new Bundles new Clickatell\SMSOptInAndOutBundle\ClickatellSMSOptInAndOutBundle(), new Clickatell\Symfony\ClickatellBundle(), );
We also need some config for the Clickatell bundle — I opted to created a new file and import it
I decided to create 2 tables for my project — on for logging incoming text messages (MO) and one for the subscribers. See the classed in src/Clickatell/SMSOptInOutBundle/Entity/* for more detail.
You can created them manualy or my using this command:
$ php app/console doctrine:database:create
Now I kept it simple and created two controllers — one for testing purposes and one as the callback url from Clickatell. See
Clickatell/SMSOptInAndOutBundle/Controller/CallbackController.php Clickatell/SMSOptInAndOutBundle/Controller/DefaultController.php
The callback controller user the Keyword Manager and it’s strategies to identify and save/remove subscribers from the database.
see Clickatell/SMSOptInAndOutBundle/Keyword/* for more detail.
Don’t forget your configs for routing:
Clickatell/SMSOptInAndOutBundle/Resources/config/routing.yml
About
A simple Symfony tutorial on using Clickatell’s API to have your user opt in and out of SMS marketing/notifications.