LoginSignup
6

More than 5 years have passed since last update.

apache php mysqlをインストール(yum)

Posted at

apache

sudo yum install httpd
sudo chkconfig httpd on
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.org
vim /etc/httpd/conf/httpd.conf
/etc/httpd/conf/httpd.conf
ServerTokens Prod
ServerSignature Off
Options Indexes → Options -Indexes FollowSymLinks
※var/www/html内のもの
ServerName www.example.com:80
NameVirtualHost *:80

設定を反映

sudo service httpd configtest
sudo service httpd start
chkconfig httpd on

※ヴァーチャルホストの設定を別ファイルに記載でもOK

cd /etc/httpd/conf.d
vim vhost.conf

バーチャルホスト用にフォルダを作成

mkdir -p /var/www/vhosts/default/public

php

yum install -y php php-devel php-mysql php-mbstring php-gd php-pear httpd-devel
php -v
cp /etc/php.ini /etc/php.ini.org
vim /etc/php.ini
/etc/php.ini
error_log = /var/log/php.log
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
display_errors = On
mbstring.language = Japanese
expose_php = Off
date.timezone = Asia/Tokyo
max_execution_time = 300
magic_quotes_gpc = Off
upload_max_filesize = 200M
mbstring.internal_encoding = UTF-8
mbstring.http_input = auto
mbstring.http_output = pass
mbstring.detect_order = auto
;mbstring.substitute_character = none;

max_file_uploads = 100
post_max_size = 100M
upload_max_filesize 100M

設定を反映

service httpd restart

mysql

yum install -y mysql-server
cp /etc/my.cnf /etc/my.cnf.org
vim /etc/my.cnf
/etc/my.cnf
[mysqld]以下に追加
character_set_server=utf8
default-storage-engine=InnoDB
innodb_file_per_table
group_concat_max_len=10000000

[mysql]
default-character-set=utf8

[mysqldump]
default-character-set=utf8

設定を反映

service mysqld start
chkconfig mysqld on

mysqlの初期設定

mysql_secure_installation
mysql -u root -p

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6