LaravelをComposerで4.1に入れる方法

Nov 2, 2014
AD:

Laravelを使っているのですが、クライアントのサーバの環境がphp5.3.*だったので、仕方なく4.1を使用することにしました。
4.2からRequirementsが、5.4以上になっています。
これで、4.1のLaravelのプロジェクトができます。

Documentsでは、laravel.pharを/usr/local/binに入れれとかあるのですが、肝心のlaravel.pharがどこにもなくて、地味に悩みました。

Twitter: 0 | Facebook: 0 | Google Plus: 0 | Hatena: 1 | Pocket: 0 | Total: 1 | Feedly: 0

Drupalをコマンドで管理できるDrushが便利

Oct 30, 2014
AD:

Drushのインストール

Drupalをコマンドで管理できるDrushが便利なので紹介
https://github.com/drush-ops/drush

composerが入っていない場合、composerをインストール

Durpal 7はこんな感じで終了

使い方

なにができるかというと、各種モジュールのダウンロード、有効化などがコマンドラインでできます。
例えば、Feedsを使いたいときは下記のコマンドで終了です。
関連のモジュールもすべてインストールしてくれるので、便利です。
コマンド化使えるということは、スクリプトで自動化もできたりしますので、これまた便利

コマンド一覧

はじめによく使うやつを

drush dl モジュール名 モジュールのダウンロード、関連のモジュールもダウンロード
drush en モジュール名 モジュールの有効化、関連のモジュールも有効化
drush dis モジュール名 モジュールの無効化
drush pm-list –type=Module –no-core –status=enabled 有効にしているモジュールの一覧

モジュールの管理だけなく、ほかにもいろいろできますので、コマンド一覧を貼っておきます。
Core Drush commands: (core)

archive-dump (ard,archive-backup, arb) Backup your code, files, and database into a single file.
archive-restore(arr) Expand a site archive into a Drupal web site.
browse Display a link to a given path or open link in a browser.
core-cli (php) Open an interactive shell on a Drupal site.
core-config (conf,config) Edit drushrc, site alias, and Drupal settings.php files.
core-cron (cron) Run all cron hooks in all active modules for specified site.
core-execute (exec,execute) Execute a shell command. Usually used with a site alias.
core-quick-drupal(qd) Download, install, serve and login to Drupal with minimal configuration and dependencies.
core-requirements (status-report, rq) Provides information about things that may be wrong in your Drupal installation, if any.
core-rsync (rsync) Rsync the Drupal tree to/from another server using ssh.
core-status (status,st) Provides a birds-eye view of the current Drupal installation, if any.
core-topic (topic) Read detailed documentation on a given topic.
drupal-directory(dd) Return the filesystem path for modules/themes and other key folders.
help Print this help message. See drush help help for more options.
image-derive (id) Create an image derivative.
image-flush (if) Flush all derived images for a given style.
php-eval (eval, ev) Evaluate arbitrary php code after bootstrapping Drupal (if available).
php-script (scr) Run php script(s).
queue-list Returns a list of all defined queues
queue-run Run a specific queue by name
shell-alias (sha) Print all known shell alias records.
site-alias (sa) Print site alias records for all known site aliases and local sites.
site-install (si) Install Drupal along with modules/themes/configuration using the specified install profile.
site-set (use) Set a site alias to work on that will persist for the current session.
site-ssh (ssh) Connect to a Drupal site’s server via SSH for an interactive session or to run a shell command
test-clean Clean temporary tables and files.
test-run Run tests. Note that you must use the –uri option via the CLI or via a site alias.
updatedb (updb) Apply any database updates required (as with running update.php).
updatedb-status(updbst) List any pending database updates.
usage-send (usend) Send anonymous Drush usage information to statistics logging site. Usage statistics contain the Drush command name and the Drush option names, but no arguments or option values.
usage-show (ushow) Show Drush usage information that has been logged but not sent. Usage statistics contain the Drush command name and the Drush option names, but no arguments or option values.
variable-delete(vdel) Delete a variable.
variable-get (vget) Get a list of some or all site variables and values.
variable-set (vset) Set a variable.
version Show drush version.

Cache commands: (cache)

cache-clear(cc) Clear a specific cache, or all drupal caches.
cache-get(cg) Fetch a cached object and display it.
cache-rebuild(cr,rebuild) Rebuild a Drupal 8 site and clear all its caches.
cache-set(cs) Cache an object expressed in JSON or var_export() format.

Config commands: (config)

config-edit(cedit) Open a config file in a text editor. Edits are imported into active configration after closing editor.
config-export(cex) Export config from the active directory.
config-get(cget) Display a config value, or a whole configuration object.
config-import(cim) Import config from a config directory.
config-list (cli) List config names by prefix.
config-set(cset) Set config value directly in active configuration.

Field commands: (field)
field-clone Clone a field and all its instances.
field-create Create fields and instances. Returns urls for field editing.
field-delete Delete a field and its instances.
field-info View information about fields, field_types, and widgets.
field-update Return URL for field editing web page.

Project manager commands: (pm)
pm-disable (dis) Disable one or more extensions (modules or themes).
pm-download (dl) Download projects from drupal.org or other sources.
pm-enable (en) Enable one or more extensions (modules or themes).
pm-info (pmi) Show detailed info for one or more extensions (modules or themes).
pm-list (pml) Show a list of available extensions (modules and themes).
pm-refresh (rf) Refresh update status information.
pm-releasenotes(rln) Print release notes for given projects.
pm-releases (rl) Print release information for given projects.
pm-uninstall (pmu) Uninstall one or more modules.
pm-update (up) Update Drupal core and contrib projects and apply any pending database updates (Same as pm-updatecode + updatedb).
pm-updatecode (upc) Update Drupal core and contrib projects to latest recommended releases.
pm-updatestatus(ups) Show a report of available minor updates to Drupal core and contrib projects.

Role commands: (role)
role-add-perm (rap) Grant specified permission(s) to a role.
role-create (rcrt) Create a new role.
role-delete (rdel) Delete a role.
role-list (rls) Display a list of all roles defined on the system. If a role name is provided as an argument, then all of the permissions of that role will be listed. If a permission name is provided as an option, then all of the roles that have been granted that permission will be listed.
role-remove-perm(rmp) Remove specified permission(s) from a role.

Runserver commands: (runserver)
runserver (rs) Runs PHP’s built-in http server for development.

SQL commands: (sql)
sql-cli (sqlc) Open a SQL command-line interface using Drupal’s credentials.
sql-connect A string for connecting to the DB.
sql-create Create a database.
sql-drop Drop all tables in a given database.
sql-dump Exports the Drupal DB as SQL using mysqldump or equivalent.
sql-query (sqlq) Execute a query against a database.
sql-sanitize(sqlsan) Run sanitization operations on the current database.
sql-sync Copies the database contents from a source site to a target site. Transfers the database dump via rsync.

Search commands: (search)
search-index Index the remaining search items without wiping the index.
search-reindex Force the search index to be rebuilt.
search-status Show how many items remain to be indexed out of the total.

State commands: (state)
state-delete (sdel) Delete a state value.
state-get (sget) Display a state value.
state-set (sset) Set a state value.

User commands: (user)
user-add-role (urol) Add a role to the specified user accounts.
user-block (ublk) Block the specified user(s).
user-cancel (ucan) Cancel a user account with the specified name.
user-create (ucrt) Create a user account with the specified name.
user-information(uinf) Print information about the specified user(s).
user-login (uli) Display a one time login link for the given user account (defaults to uid 1).
user-password (upwd) (Re)Set the password for the user account with the specified name.
user-remove-role(urrol) Remove a role from the specified user accounts.
user-unblock (uublk) Unblock the specified user(s).

Watchdog commands: (watchdog)
watchdog-delete Delete watchdog messages.
(wd-del, wd-delete)
watchdog-list(wd-list) Show available message types and severity levels. A prompt will ask for a choice to show watchdog messages.
watchdog-show(wd-show, ws) Show watchdog messages.

Other commands: (make)
make Turns a makefile into a working Drupal codebase.
make-generate(generate-makefile) Generate a makefile from the current Drupal site.

Twitter: 0 | Facebook: 0 | Google Plus: 0 | Hatena: 1 | Pocket: 0 | Total: 1 | Feedly: 0

Drupalでよく使うモジュール(プラグイン)

Sep 23, 2014
AD:

モジュールを紹介する前に、Drush使っていますか?
便利ですね、コマンドからModulesのダウンロードから、有効化とかできてちょー便利ですよ。

Administration menu

管理画面が使いやすくなります、いちいちページ移動しなくても、中ページをDropdownのリストで表示してくれます。

Before
before
After
After

Twitter: 0 | Facebook: 0 | Google Plus: 0 | Hatena: 0 | Pocket: 0 | Total: 0 | Feedly: 0

load-scripts.php のSyntax Errorで記事の編集画面JS関連が動かなくなる件

Jun 27, 2014
AD:

WordPressの本番環境の記事を編集する画面が、load-scripts.php のSyntax ErrorでVisual Editorなどが使えなくなりました。
ローカルのテスト環境では問題無く動いていたのですが、、、
Screen Shot 2014-06-27 at 10.25.31 pm

各種プラグインを無効にしたり、WordpressのVersionを下げたり、サーバを変更したり色々したのですが、まったく解決方法が見つかりませんでした。
状況的には、load-scripts.phpの出力が途中で止まって、SyntaxErrorになっている状況でした。

解決方法

出力が問題だと思ったので、wp-config.phpに下記の記述を追加して、最終的に僕は解決しました。

やれやれ。。時間を取られました。。。

Twitter: 0 | Facebook: 0 | Google Plus: 0 | Hatena: 1 | Pocket: 0 | Total: 1 | Feedly: 0

CakephpでIEだとSessionが引き継がれない件

Jul 18, 2013
AD:

SSL下にあるアプリケーションで、Sessionを情報を引き継ぐフォームを作成したのですが、IEだけ画面遷移するとSessionが引き継がれないことに気づきました。
core.phpに下記の内容を記述して、対応して回避できました。

Twitter: 0 | Facebook: 0 | Google Plus: 0 | Hatena: 0 | Pocket: 0 | Total: 0 | Feedly: 0

WordPressのバージョンを上げたらカテゴリページが404のNotFoundになる件

Jun 10, 2013
AD:

最近、クライアントのWordpressをセキュリティのために上げて、その後カテゴリのページが404のNotFoundになって困ったのでメモしておきます。

原因

プラグインが問題でした。
ただ僕の場合は2つのプラグインに問題があったようです。

URLからcategoryを消すプラグイン

このTop-level-catsが最新のWPに対応していなかったこと
なので、このプラグインは消して、新しくWP No Category Base

Pagebarを拡張するプラグイン

このPagebarが古かったことです。
地味に時間がかかったのは過去のバージョンとフォルダ名が違っていたので、バージョンアップしようと思っても違うプラグインだと思い、結局見つからず諦めていたことが原因でここに問題があることに気がつくのに時間がかかりました。

効果がなかったけどこれ以外にやったこと

僕の状況下では下記のことはやってみましたが、まったく意味がなかったです。(まぁプラグインが問題だったので当たり前なんですが)

  • パーマリンクの設定を変更してみる
  • プラグインを停止してみる
  • WordPress自体の再インストール
  • 違うテーマを設定してみる

Twitter: 0 | Facebook: 0 | Google Plus: 0 | Hatena: 0 | Pocket: 0 | Total: 0 | Feedly: 0

strtotimeはTimeZoneが違うと結果も違うよ

May 15, 2013
AD:

今朝、古いサーバからグループウェアを移設していたんですが、ファイルのダウンロードの機能がうまく行かなかったので、その際の対処をメモしておきます。

原因

ファイルを保存する際にstrtotimeを使ってファイル名を生成しているようなんですが、それが古いサーバと新しいサーバでは結果が違うことを発見、それで問題は、TimeZoneだと判明しました。
なので、下記のようにTimeZoneを指定してあげると問題解決できました。

Twitter: 0 | Facebook: 0 | Google Plus: 0 | Hatena: 0 | Pocket: 0 | Total: 0 | Feedly: 0

ZendFramework 1.12.* と Doctrine 2.3.*の連携

Feb 24, 2013
AD:

仕事でZendFramework1.*を使用することになったので、ORMにDoctrine2.3.*を使用してみました。
下記の記事は、ある程度ZendFrameworkを触ったことがある方が対象になると思います。

構築環境

composerを使ってやりたかったのですが、うまくいかなかったので、結局手動で、Fileをダウンロードして設定しました。

  • Ubuntu 12.04
  • PHP 5.3.10
  • memcache 2.2.7
  • ZendFramework 1.12.1
  • Doctrine 2.3.0

設定に入る前に

KDF Memoさんの記事を参考に導入しました。
おそらく、KDF Memoさんものより、Versionが上がっているので、File構成がだいぶ変わってきているので、地味に設定に時間がかかりました。

最終的に僕のFile構成はこうなりました。
Screen Shot 2013-02-24 at 10.41.29 PM

設定

まず、必要なものをダウンロード
Doctrine ORMよりLatestをダウンロードして、./library/vendor/に入れる
zendframework1-doctrine2より、Bisnaをダウンロードして、./libraryに入れるbinフォルダをコピーして、./に移動

cacheの設定などは、KDF Memoさんの記事に詳しく書いてありますのでそちらを参照してください。

application.iniを書き換える

doctrineの動作確認

Twitter: 0 | Facebook: 0 | Google Plus: 0 | Hatena: 0 | Pocket: 0 | Total: 0 | Feedly: 0

Ubuntu 12.04 にmemchached

Oct 24, 2012
AD:

仕事でZendFrameworkとDoctrineを使うことがあったのですが、Doctrineでmemcachedを使用するので、その際にVagrantのUbuntuにmemcachedをインストールした時のメモです。

実際にやったこと

補足

まったくまっさらなUbuntuであれば、最低限下記のものも追加で必要です。

Twitter: 0 | Facebook: 0 | Google Plus: 0 | Hatena: 0 | Pocket: 0 | Total: 0 | Feedly: 0

php4でもjson_decodeを使いたい

Aug 6, 2012
AD:

クライアントさんのサーバの未だにphp4のものがあり、APIを作成したのに、jsonが使えなくて大変だったので、メモしておきます。

状況

PHP Version 4.3.9
サーバはごく普通のホスティングレンタルなので、PHPのVersion等を上げることは不可能

対応

調べるとふた通り対応方法を発見。
upgradephpという、php5関係に追加された関数をphp4でも使えるようにするライブラリを発見。
はじめはこれで試してみるが、日本語が文字化けたので諦める。

次に、PearのJsonパッケージを使用。
しかし、サーバにPearをインストールすることはできないので、ファイルをDLしてきて対応しました。
上記のリンク先のLinksからファイルをDLして、解凍するとその中に、JSON,phpがあります。
あとは、こんな感じで使用します。

注意

$convert_dataは、配列でなくオブジェクトのデータになっているので注意してください。

Twitter: 0 | Facebook: 0 | Google Plus: 0 | Hatena: 2 | Pocket: 4 | Total: 6 | Feedly: 0

Search Keyword

Meta

face Ayumi Mizoshiri
WEB developer

FacebookPage

Popular Posts

Sorry. No data so far.

ARCHIVES