2009年3月30日月曜日

FreeBSD7.1 +Apache2.2 +MySQL5.1.32 +PHP5.2.9 +phpMyAdmin3.1.3 のインストール

FreeBSD7.1
Apache2.2
MySQL5.1.32
PHP5.2.9
phpMyAdmin3.1.3

--------------------------
FreeBSD7.1に
Apache2.2+MySQL5.1.32+PHP5.2.9+phpMyAdmin
な環境を作る話です。
FreeBSD7.1がすでにインストールされている状態から説明しています。
FreeBSD7自体のインストールについては、
また別の記事で書きますのでそちらのほうか、
ネット上にもあまたのインストール記事がありますのでそちらを参照してください。

次の順番でインストールします。
(1)MySQL
(2)Apache
(3)PHP
(4)phpMyAdmin


FreeBSD6以前だと、MySQLは自分でインストールする必要があったのですが、
FreeBSD7からはMySQLがあらかじめインストールされているようです。
ところが、やはり自分で使うのに必要なコンパイルオプションが
指定されているのか気になるところです。
私の場合、キャラクターセット(Character_set_*)が
UTF8でなければなりません。

そこで、コンパイルオプションを確認してみましょう。

#mysql
mysql> SHOW VARIABLES;
+---------------------------------+-----------------------------------+
| Variable_name | Value |
+---------------------------------+-----------------------------------+
| auto_increment_increment | 1 |
| auto_increment_offset | 1 |
| autocommit | ON |
| automatic_sp_privileges | ON |
| back_log | 50 |
| basedir | /usr/local/ |
| big_tables | OFF |
| binlog_cache_size | 32768 |
| binlog_format | STATEMENT |
| bulk_insert_buffer_size | 8388608 |
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/share/mysql/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
| completion_type | 0 |
| concurrent_insert | 1 |
| connect_timeout | 10 |
| datadir | /var/db/mysql/ |
| date_format | %Y-%m-%d |
| datetime_format | %Y-%m-%d %H:%i:%s |
| default_week_format | 0 |
| delay_key_write | ON |
| delayed_insert_limit | 100 |
| delayed_insert_timeout | 300 |
| delayed_queue_size | 1000 |
| div_precision_increment | 4 |
| engine_condition_pushdown | ON |
| error_count | 0 |
| event_scheduler | OFF |
| expire_logs_days | 0 |
| flush | OFF |
| flush_time | 0 |
| foreign_key_checks | ON |
| ft_boolean_syntax | + -><()~*:""&| |
| ft_max_word_len | 84 |
| ft_min_word_len | 4 |
| ft_query_expansion_limit | 20 |
| ft_stopword_file | (built-in) |
| general_log | OFF |
| general_log_file | /var/db/mysql/kappa.log |
| group_concat_max_len | 1024 |
| have_community_features | YES |
| have_compress | YES |
| have_crypt | YES |
| have_csv | YES |
| have_dynamic_loading | YES |
| have_geometry | YES |
| have_innodb | YES |
| have_ndbcluster | NO |
| have_openssl | NO |
| have_partitioning | YES |
| have_query_cache | YES |
| have_rtree_keys | YES |
| have_ssl | NO |
| have_symlink | YES |
| hostname | kappa.local |
| identity | 0 |
| ignore_builtin_innodb | OFF |
| init_connect | |
| init_file | |
| init_slave | |
| innodb_adaptive_hash_index | ON |
| innodb_additional_mem_pool_size | 1048576 |
| innodb_autoextend_increment | 8 |
| innodb_autoinc_lock_mode | 1 |
| innodb_buffer_pool_size | 8388608 |
| innodb_checksums | ON |
| innodb_commit_concurrency | 0 |
| innodb_concurrency_tickets | 500 |
| innodb_data_file_path | ibdata1:10M:autoextend |
| innodb_data_home_dir | |
| innodb_doublewrite | ON |
| innodb_fast_shutdown | 1 |
| innodb_file_io_threads | 4 |
| innodb_file_per_table | OFF |
| innodb_flush_log_at_trx_commit | 1 |
| innodb_flush_method | |
| innodb_force_recovery | 0 |
| innodb_lock_wait_timeout | 50 |
| innodb_locks_unsafe_for_binlog | OFF |
| innodb_log_buffer_size | 1048576 |
| innodb_log_file_size | 5242880 |
| innodb_log_files_in_group | 2 |
| innodb_log_group_home_dir | ./ |
| innodb_max_dirty_pages_pct | 90 |
| innodb_max_purge_lag | 0 |
| innodb_mirrored_log_groups | 1 |
| innodb_open_files | 300 |
| innodb_rollback_on_timeout | OFF |
| innodb_stats_on_metadata | ON |
| innodb_support_xa | ON |
| innodb_sync_spin_loops | 20 |
| innodb_table_locks | ON |
| innodb_thread_concurrency | 8 |
| innodb_thread_sleep_delay | 10000 |
| insert_id | 0 |
| interactive_timeout | 28800 |
| join_buffer_size | 131072 |
| keep_files_on_create | OFF |
| key_buffer_size | 16777216 |
| key_cache_age_threshold | 300 |
| key_cache_block_size | 1024 |
| key_cache_division_limit | 100 |
| language | /usr/local/share/mysql/english/ |
| large_files_support | ON |
| large_page_size | 0 |
| large_pages | OFF |
| last_insert_id | 0 |
| lc_time_names | en_US |
| license | GPL |
| local_infile | ON |
| locked_in_memory | OFF |
| log | OFF |
| log_bin | ON |
| log_bin_trust_function_creators | OFF |
| log_bin_trust_routine_creators | OFF |
| log_error | /var/db/mysql/kappa.local.err |
| log_output | FILE |
| log_queries_not_using_indexes | OFF |
| log_slave_updates | OFF |
| log_slow_queries | OFF |
| log_warnings | 1 |
| long_query_time | 10.000000 |
| low_priority_updates | OFF |
| lower_case_file_system | OFF |
| lower_case_table_names | 0 |
| max_allowed_packet | 1048576 |
| max_binlog_cache_size | 4294963200 |
| max_binlog_size | 1073741824 |
| max_connect_errors | 10 |
| max_connections | 151 |
| max_delayed_threads | 20 |
| max_error_count | 64 |
| max_heap_table_size | 16777216 |
| max_insert_delayed_threads | 20 |
| max_join_size | 4294967295 |
| max_length_for_sort_data | 1024 |
| max_prepared_stmt_count | 16382 |
| max_relay_log_size | 0 |
| max_seeks_for_key | 4294967295 |
| max_sort_length | 1024 |
| max_sp_recursion_depth | 0 |
| max_tmp_tables | 32 |
| max_user_connections | 0 |
| max_write_lock_count | 4294967295 |
| min_examined_row_limit | 0 |
| multi_range_count | 256 |
| myisam_data_pointer_size | 6 |
| myisam_max_sort_file_size | 2146435072 |
| myisam_recover_options | OFF |
| myisam_repair_threads | 1 |
| myisam_sort_buffer_size | 8388608 |
| myisam_stats_method | nulls_unequal |
| myisam_use_mmap | OFF |
| net_buffer_length | 8192 |
| net_read_timeout | 30 |
| net_retry_count | 1000000 |
| net_write_timeout | 60 |
| new | OFF |
| old | OFF |
| old_alter_table | OFF |
| old_passwords | OFF |
| open_files_limit | 7207 |
| optimizer_prune_level | 1 |
| optimizer_search_depth | 62 |
| pid_file | /var/db/mysql/kappa.local.pid |
| plugin_dir | /usr/local/lib/mysql/plugin |
| port | 3306 |
| preload_buffer_size | 32768 |
| profiling | OFF |
| profiling_history_size | 15 |
| protocol_version | 10 |
| pseudo_thread_id | 2 |
| query_alloc_block_size | 8192 |
| query_cache_limit | 1048576 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 0 |
| query_cache_type | ON |
| query_cache_wlock_invalidate | OFF |
| query_prealloc_size | 8192 |
| rand_seed1 | |
| rand_seed2 | |
| range_alloc_block_size | 4096 |
| read_buffer_size | 262144 |
| read_only | OFF |
| read_rnd_buffer_size | 524288 |
| relay_log | |
| relay_log_index | |
| relay_log_info_file | relay-log.info |
| relay_log_purge | ON |
| relay_log_space_limit | 0 |
| report_host | |
| report_password | |
| report_port | 3306 |
| report_user | |
| rpl_recovery_rank | 0 |
| secure_auth | OFF |
| secure_file_priv | |
| server_id | 1 |
| skip_external_locking | ON |
| skip_networking | OFF |
| skip_show_database | OFF |
| slave_compressed_protocol | OFF |
| slave_exec_mode | STRICT |
| slave_load_tmpdir | /var/tmp/ |
| slave_net_timeout | 3600 |
| slave_skip_errors | |
| slave_transaction_retries | 10 |
| slow_launch_time | 2 |
| slow_query_log | OFF |
| slow_query_log_file | /var/db/mysql/kappa-slow.log |
| socket | /tmp/mysql.sock |
| sort_buffer_size | 524288 |
| sql_auto_is_null | ON |
| sql_big_selects | ON |
| sql_big_tables | OFF |
| sql_buffer_result | OFF |
| sql_log_bin | ON |
| sql_log_off | OFF |
| sql_log_update | ON |
| sql_low_priority_updates | OFF |
| sql_max_join_size | 4294967295 |
| sql_mode | |
| sql_notes | ON |
| sql_quote_show_create | ON |
| sql_safe_updates | OFF |
| sql_select_limit | 4294967295 |
| sql_slave_skip_counter | |
| sql_warnings | OFF |
| ssl_ca | |
| ssl_capath | |
| ssl_cert | |
| ssl_cipher | |
| ssl_key | |
| storage_engine | MyISAM |
| sync_binlog | 0 |
| sync_frm | ON |
| system_time_zone | JST |
| table_definition_cache | 256 |
| table_lock_wait_timeout | 50 |
| table_open_cache | 64 |
| table_type | MyISAM |
| thread_cache_size | 0 |
| thread_handling | one-thread-per-connection |
| thread_stack | 196608 |
| time_format | %H:%i:%s |
| time_zone | SYSTEM |
| timed_mutexes | OFF |
| timestamp | 1238376720 |
| tmp_table_size | 16777216 |
| tmpdir | /var/tmp/ |
| transaction_alloc_block_size | 8192 |
| transaction_prealloc_size | 4096 |
| tx_isolation | REPEATABLE-READ |
| unique_checks | ON |
| updatable_views_with_limit | YES |
| version | 5.1.32-log |
| version_comment | FreeBSD port: mysql-server-5.1.32 |
| version_compile_machine | i386 |
| version_compile_os | portbld-freebsd7.1 |
| wait_timeout | 28800 |
| warning_count | 0 |
+---------------------------------+-----------------------------------+
269 rows in set (0.01 sec)

ということでUTF8になっているので、とりあえずOK。

#ps -ax
  :
 534 con- I 0:00.03 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/d
637 con- I 0:07.92 /usr/local/libexec/mysqld --defaults-extra-file=/var/db/mysql/m
  :

でmysqlが起動していなければ、rc.confに次の行を追加する。

[/etc/rc.conf]
mysql_enable="YES"


------------------------------
■Apache2.2.11_3のインストール


#cd /usr/ports/www/apache22
#make install clean

lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Options for apache 2.2.11_3 x
x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
x x[ ] APR_FROM_PORTS Use devel/apr as APR (beware!) x x
x x[ ] THREADS Enable threads support in APR x x
x x[ ] MYSQL Enable MySQL support for apr-dbd x x
x x[ ] PGSQL Enable PostgreSQL support for apr-dbd x x
x x[ ] SQLITE Enable SQLite support for apr-dbd x x
x x[X] IPV6 Enable IPv6 support x x
x x[ ] BDB Enable BerkeleyDB dbm x x
x x[X] AUTH_BASIC Enable mod_auth_basic x x
x x[X] AUTH_DIGEST Enable mod_auth_digest x x
x x[X] AUTHN_FILE Enable mod_authn_file x x
x x[ ] AUTHN_DBD Enable mod_authn_dbd x x
x x[X] AUTHN_DBM Enable mod_authn_dbm x x
x x[X] AUTHN_ANON Enable mod_authn_anon x x
x x[X] AUTHN_DEFAULT Enable mod_authn_default x x
x x[X] AUTHN_ALIAS Enable mod_authn_alias x x
x x[X] AUTHZ_HOST Enable mod_authz_host x x
x x[X] AUTHZ_GROUPFILE Enable mod_authz_groupfile x x
x x[X] AUTHZ_USER Enable mod_authz_user x x
x x[X] AUTHZ_DBM Enable mod_authz_dbm x x
x x[X] AUTHZ_OWNER Enable mod_authz_owner x x
x x[X] AUTHZ_DEFAULT Enable mod_authz_default x x
x x[X] CACHE Enable mod_cache x x
x x[X] DISK_CACHE Enable mod_disk_cache x x
x x[X] FILE_CACHE Enable mod_file_cache x x
x x[ ] MEM_CACHE Enable mod_mem_cache x x
x x[X] DAV Enable mod_dav x x
x x[X] DAV_FS Enable mod_dav_fs x x
x x[ ] BUCKETEER Enable mod_bucketeer x x
x x[ ] CASE_FILTER Enable mod_case_filter x x
x x[ ] CASE_FILTER_IN Enable mod_case_filter_in x x
x x[ ] EXT_FILTER Enable mod_ext_filter x x
x x[ ] LOG_FORENSIC Enable mod_log_forensic x x
x x[ ] OPTIONAL_HOOK_EXPORT Enable mod_optional_hook_export x x
x x[ ] OPTIONAL_HOOK_IMPORT Enable mod_optional_hook_import x x
x x[ ] OPTIONAL_FN_IMPORT Enable mod_optional_fn_import x x
x x[ ] OPTIONAL_FN_EXPORT Enable mod_optional_fn_export x x
x x[ ] LDAP Enable mod_ldap x x
x x[ ] AUTHNZ_LDAP Enable mod_authnz_ldap x x
x x[X] ACTIONS Enable mod_actions x x
x x[X] ALIAS Enable mod_alias x x
x x[X] ASIS Enable mod_asis x x
x x[X] AUTOINDEX Enable mod_autoindex x x
x x[X] CERN_META Enable mod_cern_meta x x
x x[X] CGI Enable mod_cgi x x
x x[X] CHARSET_LITE Enable mod_charset_lite x x
x x[ ] DBD Enable mod_dbd x x
x x[X] DEFLATE Enable mod_deflate x x
x x[X] DIR Enable mod_dir x x
x x[X] DUMPIO Enable mod_dumpio x x
x x[X] ENV Enable mod_env x x
x x[X] EXPIRES Enable mod_expires x x
x x[X] HEADERS Enable mod_headers x x
x x[X] IMAGEMAP Enable mod_imagemap x x
x x[X] INCLUDE Enable mod_include x x
x x[X] INFO Enable mod_info x x
x x[X] LOG_CONFIG Enable mod_log_config x x
x x[X] LOGIO Enable mod_logio x x
x x[X] MIME Enable mod_mime x x
x x[X] MIME_MAGIC Enable mod_mime_magic x x
x x[X] NEGOTIATION Enable mod_negotiation x x
x x[X] REWRITE Enable mod_rewrite x x
x x[X] SETENVIF Enable mod_setenvif x x
x x[X] SPELING Enable mod_speling x x
x x[X] STATUS Enable mod_status x x
x x[X] UNIQUE_ID Enable mod_unique_id x x
x x[X] USERDIR Enable mod_userdir x x
x x[X] USERTRACK Enable mod_usertrack x x
x x[X] VHOST_ALIAS Enable mod_vhost_alias x x
x x[X] FILTER Enable mod_filter x x
x x[X] VERSION Enable mod_version x x
x x[ ] PROXY Enable mod_proxy x x
x x[ ] PROXY_CONNECT Enable mod_proxy_connect x x
x x[ ] PROXY_FTP Enable mod_proxy_ftp x x
x x[ ] PROXY_HTTP Enable mod_proxy_http x x
x x[ ] PROXY_AJP Enable mod_proxy_ajp x x
x x[ ] PROXY_BALANCER Enable mod_proxy_balancer x x
x x[X] SSL Enable mod_ssl x x
x x[ ] SUEXEC Enable mod_suexec x x
x x[ ] CGID Enable mod_cgid x x
tqmqqqqv(+)qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqjqu
x [ OK ] Cancel x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj


x x[X] MYSQL Enable MySQL support for apr-dbd
x x[ ] IPV6 Enable IPv6 support x x

『Enable MySQL support for apr-dbd』とは?
MySQLをインストールしたし、なにか利点でもあるのだろうか。
以前はなかったような気がするし、ただ単に気がついてなかっただけかもしれない。

apr-dbdを調べてみたら
apr-dbd:
Apache SQL/Database Frameworkのデータベースの抽象化ドライバらしい。
http://apache.webthing.com/database/

まぁ。いれとこう(笑)

IPV6。まだあんまり使われていないからいらない。
どうせそのうちサーバー入れ替えるし。

#cd /usr/ports/lang/php5
#make install clean

lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Options for php5 5.2.9 x
x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
x x[X] CLI Build CLI version x x
x x[X] CGI Build CGI version x x
x x[X] APACHE Build Apache module x x
x x[ ] DEBUG Enable debug x x
x x[X] SUHOSIN Enable Suhosin protection system (not for jails) x x
x x[ ] MULTIBYTE Enable zend multibyte support x x
x x[ ] IPV6 Enable ipv6 support x x
x x[X] MAILHEAD Enable mail header patch x x
x x[ ] REDIRECT Enable force-cgi-redirect support (CGI only) x x
x x[ ] DISCARD Enable discard-path support (CGI only) x x
x x[X] FASTCGI Enable fastcgi support (CGI only) x x
x x[X] PATHINFO Enable path-info-check support (CGI only) x x
x x x x
x x x x
x x x x
tqmqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqjqu
x [ OK ] Cancel x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj


つづいて
PHP5-extensions をインストールします。
これを入れることでApache上に組み込まれます。

#cd /usr/ports/lang/php5-extensions
#make install clean

lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Options for php5-extensions 1.3 x
x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
x x [ ] BCMATH bc style precision math functions x x
x x [ ] BZ2 bzip2 library support x x
x x [ ] CALENDAR calendar conversion support x x
x x [X] CTYPE ctype functions x x
x x [ ] CURL CURL support x x
x x [ ] DBA dba support x x
x x [ ] DBASE dBase library support x x
x x [X] DOM DOM support x x
x x [ ] EXIF EXIF support x x
x x [ ] FILEINFO fileinfo support x x
x x [X] FILTER input filter support x x
x x [ ] FRIBIDI FriBidi support x x
x x [ ] FTP FTP support x x
x x [ ] GD GD library support x x
x x [ ] GETTEXT gettext library support x x
x x [ ] GMP GNU MP support x x
x x [X] HASH HASH Message Digest Framework x x
x x [X] ICONV iconv support x x
x x [ ] IMAP IMAP support x x
x x [ ] INTERBASE Interbase 6 database support (Firebird) x x
x x [X] JSON JavaScript Object Serialization support x x
x x [ ] LDAP OpenLDAP support x x
x x [ ] MBSTRING multibyte string support x x
x x [ ] MCRYPT Encryption support x x
x x [ ] MHASH Crypto-hashing support x x
x x [ ] MING ming shockwave flash support x x
x x [ ] MSSQL MS-SQL database support x x
x x [ ] MYSQL MySQL database support x x
x x [ ] MYSQLI MySQLi database support x x
x x [ ] NCURSES ncurses support (CLI only) x x
x x [ ] ODBC unixODBC support x x
x x [ ] OPENSSL OpenSSL support x x
x x [ ] PCNTL pcntl support (CLI only) x x
x x [X] PCRE Perl Compatible Regular Expression support x x
x x [ ] PDF PDFlib support (implies GD) x x
x x [X] PDO PHP Data Objects Interface (PDO) x x
x x [X] PDO_SQLITE PDO sqlite driver x x
x x [ ] PGSQL PostgreSQL database support x x
x x [X] POSIX POSIX-like functions x x
x x [ ] PSPELL pspell support x x
x x [ ] READLINE readline support (CLI only) x x
x x [ ] RECODE recode support x x
x x [X] SESSION session support x x
x x [ ] SHMOP shmop support x x
x x [X] SIMPLEXML simplexml support x x
x x [ ] SNMP SNMP support x x
x x [ ] SOAP SOAP support x x
x x [ ] SOCKETS sockets support x x
x x [X] SPL Standard PHP Library x x
x x [X] SQLITE sqlite support x x
x x [ ] SYBASE_CT Sybase database support x x
x x [ ] SYSVMSG System V message support x x
x x [ ] SYSVSEM System V semaphore support x x
x x [ ] SYSVSHM System V shared memory support x x
x x [ ] TIDY TIDY support x x
x x [X] TOKENIZER tokenizer support x x
x x [ ] WDDX WDDX support (implies XML) x x
x x [X] XML XML support x x
x x [X] XMLREADER XMLReader support x x
x x [ ] XMLRPC XMLRPC-EPI support x x
x x [X] XMLWRITER XMLWriter support x x
x x [ ] XSL XSL support (Implies DOM) x x
x x [ ] YAZ YAZ support (ANSI/NISO Z39.50) x x
x x [ ] ZIP ZIP support x x
x x [ ] ZLIB ZLIB support x x
tqmqqqqqqqv(+)qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqjqu
x [ OK ] Cancel x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

重要な選択項目
MYSQLI
MySQL 4.1以降の拡張機能が使えるようになります。

[X] MYSQLI MySQLi database support

MBSTRING
日本語サポート。マルチバイト文字列に対応します。

[X] MBSTRING multibyte string support

php5-gd 5.2.9
[X] JIS Enable JIS-mapped Japanese font support
これは便利かもしれないのでチェック入れました。

PHPのインストールまで終わりました。
ここからApachenの設定を行います

■Apacheの設定
apache22の設定ファイルを変更します
#cd /usr/local/etc/apache/
<IfModule mime_module>ディレクティブに
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
を追加します。

[httpd.conf]
<IfModule mime_module>
:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
  :
</IfModule>

index.phpを開けるように修正します。
サーバーのドメイン名を記述します。
[httpd.conf]
:
<IfModule dir_module>
DirectoryIndex index.html index.htm index.php
</IfModule>

:
#ServerName www.example.com:80
ServerName daimazin.local:80

自宅内のテストサーバーならこのように修正します。

ただ、daimazin.localのIPアドレスがDNSで解決できないと
/var/log/httpd-error.log
にエラーが表示され

[Mon Mar 30 22:08:48 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of "daimazin.local"

Apacheが起動しません。

/etc/hosts

ファイルにdaimzinを登録します。
ファイルの最後に追加します

[/etc/hosts]
192.168.0.200 daimazin.local

次にphp.iniファイルを作成します。
#cd /usr/local/etc
#cp php.ini-dist php.ini

次に動作確認用のtest.phpを作成します。
#cd /usr/local/www/apache22/data

[test.php]
<?
phpinfo();
?>


次にアパッチの自動起動の設定を行います。
rc.confの最終行に次の一文を追加します。

[/etc/rc.conf]
apache22_enable="YES"



■Apacheの起動
#apachectl start
[Mon Apr 12 11:09:03 2010] [warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter

とか出ますが体勢に影響はないので気にしない。。。

#ps -ax
859 ?? Ss 0:00.51 /usr/local/sbin/httpd -k start
860 ?? I 0:00.00 /usr/local/sbin/httpd -k start
861 ?? I 0:00.00 /usr/local/sbin/httpd -k start
862 ?? I 0:00.00 /usr/local/sbin/httpd -k start
863 ?? I 0:00.00 /usr/local/sbin/httpd -k start
864 ?? I 0:00.00 /usr/local/sbin/httpd -k start

のようにhttpdが表示されていればOK
再起動してApacheが自動起動するか確認します。

#reboot

■他のPCからの接続テスト

InternetExplorerなどで
http://192.168.0.200/
のようにURLを指定して表示できるか確認します。

『 It works! 』

と表示が出れば正常にApacheが動作しています。
表示で出なければhttpd.confを見直してください。
修正した後はApacheを停止起動させるか、
リスタートします。

#apachectl stop
#apachectl start
#apachectl restart

つぎにPHPのテストスクリプトを実行してみます。

http://192.168.0.200/test.php



完成☆

phpMyAdmin3.1.3のインストールへとつづく

phpMyAdmin3.1.3のインストール

.

0 件のコメント: