忍者ブログ

鯖設定とプログラム

メモ。

<< | 2024/05 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | >>

[PR]

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

crontabの設定

phpを定期的に動かす場合

min hour day month week command

例:月曜日の8時と8時30分に実行
# vi /etc/crontab
0,30 20 * * 1 root php /PATH/hogehoge.php
PR

拡張子無しでのアクセス

httpd.conf

該当ディレクトリのオプションにMultiviewsを追加

<Directory />
Options Multiviews
</Directory>

エラー:XMLドキュメント内では最上位の要素に限り、使用できます。

XMLを吐くプログラムを作る機会があったのでメモ。

下記のエラーが出る場合、
IEの場合:
XMLドキュメント内では最上位の要素に限り、使用できます。
FIREFOXの場合:
XML パースエラー: ドキュメント要素の後ろに不正な文字列があります。

<?xml version="1.0" encoding="UTF-8" ?>
<date>2007-03-05</date>
<id>0001</id>
<first>
    <hoge>hoge</hoge>
</first>
<second>hogehoge</second>
これだと上のエラーが出る。

最上位の要素で全てを囲む。
<?xml version="1.0" encoding="UTF-8" ?>
<field>
    <date>2007-03-05</date>
    <id>2</id>
    <first>
       <hoge>hoge2</hoge>
    </first>
    <second>hogehoge2</second>
</field>
これでOK。
要素が多かったり子要素があっても同じ。

phpMyAdminを2.10.0.2にアップグレードする。

前回と同様にphpMyAdminをアップグレードする。

phpMyAdmin 2.10.0.2
http://jaist.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-2.10.0.2-all-languages-utf-8-only.tar.bz2
からダウンロードして/usr/local/src/に置く

# cd /usr/local/src/
# cp phpMyAdmin-2.10.0.2-all-languages-utf-8-only.tar.bz2 /var/www/html/
# cd /var/www/html/
# tar jxvf phpMyAdmin-2.10.0.2-all-languages-utf-8-only.tar.bz2
# cp phpMyAdmin/config.inc.php config.inc.php
# rm -rf phpMyAdmin
# mv phpMyAdmin-2.10.0.2-all-languages-utf-8-only phpMyAdmin
# cp config.inc.php phpMyAdmin/config.inc.php

前回の設定ファイルをコピーして保存しておき、フォルダごと削除。
phpMyAdmin-2.10.0.2-all-languagesフォルダをphpMyAdminに変更。
保存しておいた設定ファイルを新しいphpMyAdminフォルダにコピペ。

http://localhost/phpMyAdmin/ にブラウザからアクセス。
前回のcookieが残っているとログインした状態から始まるので、ログアウト。
ログイン画面が2.10.0.2になっており、ログイン後にも2.10.0.2になっていればOK。

これでアップグレードは完了。

だが、「mcrypt 拡張をロードできません。PHP の設定を確認してください」とのエラーが出ている。
次回、PHPのインストール時に--with-mcryptを付けてインストールする事にした。
データ登録、削除や作業自体は今まで通り問題なく不都合はなかったが公開サーバへの適応は見合わせる。

phpMyAdminアップグレード履歴
phpMyAdmin2.8.2.4をインストール
phpMyAdmin2.8.2.4からphpMyAdmin 2.9.1.1にアップグレード
phpMyAdmin 2.9.1.1からphpMyAdmin 2.9.2にアップグレード

MySQLメモ

全てのデータベースをバックアップ
# mysqldump -u root -p -x --all-databases > /PATH/hogehoge.sql

特定のデータベースをバックアップ
# mysqldump -u root -p データベース名 > /PATH/hogehoge.sql

全てのデータベースを復元
# mysql -u root -p < /PATH/hogehoge.sql

特定のデータベースのみの復元は
# mysql -u root -p データベース名 < /PATH/hogehoge.sql

公開サーバをPHP5.2.1にアップグレードする RHEL4(RedHat Enterprise Linux ES v4)

ローカルサーバのPHP5.2.1が安定しているようなので公開サーバにも適用した。

公開サーバにはpostgresqlも入っているので、--with-pgsql=/usrを追加。

# ./configure --prefix=/usr/local --bindir=/usr/local/bin/ --with-apxs2=/usr/sbin/apxs --with-mysql=/usr --with-pgsql=/usr --enable-mbstr-enc-trans --enable-mbstring --enable-mbregex --enable-track-vars --with-freetype-dir=/usr --with-png-dir=/usr --with-gd --enable-gd-native-ttf --with-ttf --with-gettext --with-ncurses --with-gmp --with-iconv --with-jpeg-dir=/usr --with-openssl --with-png --with-pspell --with-regex --with-xml --with-expat-dir=/usr --with-zlib --with-layout=GNU --enable-bcmath --enable-exif --enable-ftp --enable-magic-quotes --enable-safe-mode --enable-sockets --enable-sysvsem --enable-sysvshm --enable-discard-path --enable-track-vars --enable-trans-sid --enable-yp --enable-wddx --enable-mbstring --enable-mbstr-enc-trans --enable-mbregex --without-oci8 --with-pear --with-kerberos=/usr/kerberos --with-ldap=shared --enable-memory-limit --enable-bcmath --enable-shmop --enable-calendar --enable-dbx --enable-dio --with-pdo-mysql --enable-mcal

ここからは前回のローカルサーバと同じ

# php -v
PHP 5.2.1 (cli) (built: Feb 27 2007 12:30:31)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

Net_UserAgent_Mobile 0.30.0 にアップグレード

Net_UserAgent_Mobileがバージョンアップされてたんで、アップグレードした。
http://pear.php.net/package/Net_UserAgent_Mobile

# pear list
Installed packages, channel pear.php.net:
=========================================
Package              Version State
Archive_Tar          1.3.1   stable
Console_Getopt       1.2     stable
DB                   1.7.6   stable
HTTP                 1.4.0   stable
HTTP_Request         1.3.0   stable
Mail                 1.1.10  stable
Net_SMTP             1.2.8   stable
Net_Socket           1.0.6   stable
Net_URL              1.0.14  stable
Net_UserAgent_Mobile 0.29.0  beta
PEAR                 1.4.11  stable
XML_Parser           1.2.7   stable
XML_RPC              1.5.0   stable

# pear upgrade -f Net_UserAgent_Mobile

WARNING: failed to download pear.php.net/Net_UserAgent_Mobile within preferred state "stable", will instead download version 0.30.0, stability "beta"
Did not download optional dependencies: pear/XML_RPC, use --alldeps to download automatically
warning: pear/PEAR dependency package "pear/Console_Getopt" downloaded version 1.2.2 is not the recommended version 1.2.1
downloading Net_UserAgent_Mobile-0.30.0.tgz ...
Starting to download Net_UserAgent_Mobile-0.30.0.tgz (31,955 bytes)
.........done: 31,955 bytes
downloading PEAR-1.5.0.tgz ...
Starting to download PEAR-1.5.0.tgz (286,143 bytes)
...done: 286,143 bytes
downloading Archive_Tar-1.3.2.tgz ...
Starting to download Archive_Tar-1.3.2.tgz (17,150 bytes)
...done: 17,150 bytes
downloading Structures_Graph-1.0.2.tgz ...
Starting to download Structures_Graph-1.0.2.tgz (30,947 bytes)
...done: 30,947 bytes
downloading Console_Getopt-1.2.2.tgz ...
Starting to download Console_Getopt-1.2.2.tgz (4,252 bytes)
...done: 4,252 bytes
upgrade ok: channel://pear.php.net/Console_Getopt-1.2.2
upgrade ok: channel://pear.php.net/Structures_Graph-1.0.2
upgrade ok: channel://pear.php.net/Archive_Tar-1.3.2
upgrade ok: channel://pear.php.net/PEAR-1.5.0
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
upgrade ok: channel://pear.php.net/Net_UserAgent_Mobile-0.30.0
To install use "pear install pear/PEAR#featurename"

pear自体も古かったので最新になった。

# pear list

Installed packages, channel pear.php.net:
=========================================
Package              Version State
Archive_Tar          1.3.2   stable
Console_Getopt       1.2.2   stable
DB                   1.7.6   stable
HTTP                 1.4.0   stable
HTTP_Request         1.3.0   stable
Mail                 1.1.10  stable
Net_SMTP             1.2.8   stable
Net_Socket           1.0.6   stable
Net_URL              1.0.14  stable
Net_UserAgent_Mobile 0.30.0  beta
PEAR                 1.5.0   stable
Structures_Graph     1.0.2   stable
XML_Parser           1.2.7   stable
XML_RPC              1.5.0   stabl

Google sitemapメモ

Googleに膨大なページ数を登録する機会があったのでメモ。

<?xml version="1.0" encoding="UTF-8"?>
  < urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
   < url>
    < loc>http://www.example.com/</loc>
    < lastmod>2007-02-01</lastmod>
    < changefreq>monthly</changefreq>
    < priority>0.6</priority>
   </url> 
  </urlset>

<url>の子は<loc>のみ必須。あとは省略可。

1つのサイトマップは5万<url>までなので5万ページごとにサイトマップを作成。
仮にsitemap01.xml~sitemap10.xmlまで10個のサイトマップを作ったとする。
アップロードしてgzipで圧縮。
# gzip sitemap01.xml のように

今度はこの10個のサイトマップのサイトマップ(サイトマップインデックス)を作る。
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84">
   <sitemap>
      <loc>http://www.example.com/sitemap01.xml.gz</loc>
      <lastmod>2007-02-01</lastmod>
   </sitemap>
   <sitemap>
      <loc>http://www.example.com/sitemap02.xml.gz</loc>
      <lastmod>2007-02-01</lastmod>
   </sitemap>
</sitemapindex>
.
.
.
sitemap10まで作成し完成。
<loc>はgzipで圧縮したサイトマップのアドレスにする。

これをウェブマスターツールのサイトマップより読み込ませる。
5分ほどで読みに来る。成功すればステータスがOKになり、Sitemapの横にインデックスの文字が出る。
これはサイトマップがサイトマップインデックスとして読み込まれたという事。

以上

PHP5.2.1にアップグレードする RHEL4(RedHat Enterprise Linux ES v4)

PHP5.2.0からPHP5.2.1にローカルサーバをアップグレードする。
その後安定していれば公開サーバにも入れる。

前回のPHP5.1.5からPHP5.2.0にアップグレードと同様に全く問題なしにインストール出来た。

# cd /usr/local/src/

# wget http://jp.php.net/get/php-5.2.1.tar.bz2/from/this/mirror
# ls -al
php-5.2.1.tar.bz2

# tar jxvf php-5.2.1.tar.bz2
# cd php-5.2.1

# ./configure --prefix=/usr/local --bindir=/usr/local/bin/ --with-apxs2=/usr/sbin/apxs --with-mysql=/usr --enable-mbstr-enc-trans --enable-mbstring --enable-mbregex --enable-track-vars --with-freetype-dir=/usr --with-png-dir=/usr --with-gd --enable-gd-native-ttf --with-ttf --with-gettext --with-ncurses --with-gmp --with-iconv --with-jpeg-dir=/usr --with-openssl --with-png --with-pspell --with-regex --with-xml --with-expat-dir=/usr --with-zlib --with-layout=GNU --enable-bcmath --enable-exif --enable-ftp --enable-magic-quotes --enable-safe-mode --enable-sockets --enable-sysvsem --enable-sysvshm --enable-discard-path --enable-track-vars --enable-trans-sid --enable-yp --enable-wddx --enable-mbstring --enable-mbstr-enc-trans --enable-mbregex --without-oci8 --with-pear --with-kerberos=/usr/kerberos --with-ldap=shared --enable-memory-limit --enable-bcmath --enable-shmop --enable-calendar --enable-dbx --enable-dio --with-pdo-mysql --enable-mcal

+--------------------------------------------------------------------+
| License:                                                                                                  |
| This software is subject to the PHP License, available in this                          |
| distribution in the file LICENSE.  By continuing this installation                        |
| process, you are bound by the terms of this license agreement.                        |
| If you do not agree with the terms of this license, you must abort                     |
| the installation process at this point.                                                           |
+--------------------------------------------------------------------+

Thank you for using PHP.

# make

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).

アパッチを止める
/etc/init.d/httpd stop
インストール
# make install
アパッチ起動
/etc/init.d/httpd start

これでアップグレードは完了。

# php -v

5.2.1の情報に変わっていればOK。
PHP.iniの設定もそのままなので大丈夫。

PHPアップグレード履歴
PHP4.3.9からPHP5.1.5にアップグレード
PHP5.1.5からPHP5.2.0にアップグレード
PHP5.2.0からPHP5.2.1にアップグレード

ローカルサーバの設定を公開サーバにも適用した

phpMyAdminを2.9.2にアップグレード

文字化け対策

安定しているようなので上記のローカルサーバの設定を公開サーバにも適用した。
ブログ内検索
カレンダー
04 2024/05 06
S M T W T F S
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
プロフィール
HN:
No Name Ninja
性別:
非公開
自己紹介:
へなちょこサーバ管理者

HPは作れるがプログラムが出来なかったので、PHPを覚えた。

公開サーバ環境:
CPU:Pentium M 740 1.73GHz
Mem:512MB DDR2
HDD1:160GB SATA
HDD2:160GB SATA
OS:RedHat Enterprise Linux ES v4
Apache:httpd-2.0.52-28ent
MySQL:mysql-4.1.20-1
PHP:php-5.2.5
JavaSE:JDK6
Tomcat:apache-tomcat-5.5.20
Apache Tomcat Connector:jk-1.2.19

ローカルサーバ環境:
DELL INSPIRON4000
OS:RedHat Enterprise Linux ES v4
Apache:httpd-2.0.52-28ent
MySQL:mysql-4.1.20-1
PHP:php-5.2.5
JavaSE:JDK6
Tomcat:apache-tomcat-5.5.20
Apache Tomcat Connector:jk-1.2.19

ローカルPC
OS:Windows7
最新コメント
[03/14 mietwagen]
[02/02 Online poker]
[03/13 ほし]
[03/01 へなとこ]
[11/14 ポポ]
アクセス解析
?
カウンター
起動、終了、再起動
Apacheの起動
/etc/init.d/httpd start
Apacheの終了
/etc/init.d/httpd stop
Apacheの再起動
/etc/init.d/httpd restart

Tomcatの起動
/usr/local/tomcat/bin/startup.sh
Toncatの終了
/usr/local/tomcat/bin/shutdown.sh

MySQLの起動
/etc/rc.d/init.d/mysqld start
MySQLの終了
/etc/rc.d/init.d/mysqld stop
MySQLの再起動
/etc/rc.d/init.d/mysqld restart

vsftpdの起動
/etc/init.d/vsftpd start
vsftpdの終了
/etc/init.d/vsftpd stop
vsftpdの再起動
/etc/init.d/vsftpd restart
場所
httpd.conf
/etc/httpd/conf/httpd.conf

AdminControlMenu: AdminMenu | NewEntry | EditComment | EditTrackback

忍者ブログ [PR]