kitayama

写真 アプリ開発 時々旅行 そしてテニス

OS-X yosemite phpmyadmin を動作させる(php/mysql連動)

os-x で phpmyadmin を動作


mysql / php は入っているものとします。

 

apache 確認(yosemite はapache 初期導入済み)

 

$ httpd -v

Server version: Apache/2.4.28 (Unix)

Server built:   Oct 29 2017 19:23:15

 

apache 起動

sudo /usr/sbin/apachectl start

 

php.ini 設置

sudo cp -p /etc/php.ini.default /etc/php.ini

apache/php 連動

$ sudo vi /etc/apache2/httpd.conf
#LoadModule php5_module libexec/apache2/libphp5.so
↓
LoadModule php5_module libexec/apache2/libphp5.so

apache再起動

$ sudo /usr/sbin/apachectl restart

 

phpmyadmin設置

ダウンロード

ここ からダウンロード(ブラウザでダウンロード)

 

設置

自分の環境では自動的に unzip されるが、必要なら、upzip

$ sudo cp -rf phpMyAdmin-4.7.9-all-languages /Library/WebServer/Documents/phpMyAdmin

設定ファイル変更

$ cd /Library/WebServer/Documents/phpMyAdmin/
$ sudo mv config.sample.inc.php config.inc.php
$ sudo vi config.inc.php
$cfg['Servers'][$i]['host'] = ‘localhost’;
↓
$cfg['Servers'][$i]['host'] = ’127.0.0.1′;

Larval 5.5 をOS-X にインストール

OS-X ELCAPTION に laravel をインストールしました。その忘備録


PHP が 5.5 なので、PHP を7に上げる。

 

brew がないのでインストール

OS-X ELCAPTION(10.11) には /usr/local/bin がないので作成
$ sudo mkdir /usr/local/bin
path を通す。
$ vim ~/.bash_profile
export PATH=/usr/local:$PATH

brewインストール

$ ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

path を通す。
$ source ~/.bash_profile

 

home-brew のlink が、PHPに届いていないようなので、それを設定します。

core を確認
$ brew -vHomebrew 1.5.9Homebrew/homebrew-core (git revision b1ce; last commit 2018-03-09)
php -vPHP 5.5.38 (cli) (built: Oct 29 2017 20:49:07) Copyright (c) 1997-2015 The PHP GroupZend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
$ brew taphomebrew/core
core とPHP をhomebrewに通す
$ brew tap homebrew/core
$ brew tap homebrew/php
php7を確認
$ brew search php7
brew search php7==> Searching local taps...homebrew/php/php70                         homebrew/php/php70-uv                      homebrew/php/php71-timecophomebrew/php/php70-amqp                    homebrew/php/php70-v8js                    homebrew/php/php71-

・・・・・・

 homebrew/php/php71-tidy
php7をインストール
$ brew install homebrew/php/php70
path を通す
$ vi .bash_profile 
export PATH="$(brew --prefix homebrew/php/php70)/bin:$PATH"
$ source .bash_profile
phpバージョンを確認
$ php -v
PHP 7.0.27 (cli) (built: Jan  5 2018 12:23:32) ( NTS )Copyright (c) 1997-2017 The PHP GroupZend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies

mySQLをインストール

mySQL環境を確認

$ brew info mysql
mysql: stable 5.7.21 (bottled), devel 8.0.4-rcOpen source relational database management systemhttps://dev.mysql.com/doc/refman/5.7/en/Conflicts with:  mariadb (because mysql, mariadb, and percona install the same binaries.)  mariadb-connector-c (because both install plugins)  mysql-cluster (because mysql, mariadb, and percona install the same binaries.)  mysql-connector-c (because both install MySQL client libraries)  percona-server (because mysql, mariadb, and percona install the same binaries.)Not installedFrom: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mysql.rb==> DependenciesBuild: cmake ✘Required: openssl ✔==> RequirementsRequired: macOS >= 10.7 ✔==> Options--with-debug Build with debug support--with-embedded Build the embedded server--with-local-infile Build with local infile loading support--with-memcached Build with InnoDB Memcached plugin--with-test Build with unit tests--devel Install development version 8.0.4-rc==> CaveatsWe've installed your MySQL database without a root password. To secure it run:    mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:    mysql -uroot
To have launchd start mysql now and restart at login:  brew services start mysqlOr, if you don't want/need a background service you can just run:  mysql.server start

mySQLをインストール

$ brew install mysql
mysql.server startStarting MySQL. SUCCESS!

mySQLにルートを設定

mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD PLUGIN can be used to test passwordsand improve security. It checks the strength of passwordand allows the users to set only those passwords which aresecure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No: Please set the password for root here.
New password:
Re-enter new password: By default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them. This is intended only fortesting, and to make the installation go a bit smoother.You should remove them before moving into a productionenvironment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : ySuccess.

Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess atthe root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) :
... skipping.By default, MySQL comes with a database named 'test' thatanyone can access. This is also intended only for testing,and should be removed before moving into a productionenvironment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) :
... skipping.Reloading the privilege tables will ensure that all changesmade so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) :
... skipping.All done!

mySQLにユーザーを設定

$ mysql -uroot -p
grant all privileges on *.* to xxxxx@localhost identified by 'xxxxxxx';

laravelインストール

$composer global require "laravel/installer=~1.1"

プロジェクトを作ってみる

composer create-project laravel/laravel test --prefer-dist
cd testsudo chmod -R 777 storage

プロジェクト起動

php artisan serve