PHPのconfigureのオプションについて

このQ&Aのポイント
  • WindowsメインでLinuxをあまり使わない者ですが、CentOS5.5にPHP5.2とMySQL4.0の環境を作りました。しかし、PHPのmysql_connect()でエラーが発生し、原因がわかりません。
  • ソースからコンパイルしてインストールしたPHPとMySQLは正常に動作しており、データベースも作成できます。しかし、'/tmp/mysql.sock'のアクセス権限やPHPとMySQLの設定を確認しても問題はないようです。
  • phpinfo()の結果をさくらサーバーと比較すると、'./configure'のオプションが異なります。これが関係しているのでしょうか?質問者の知識が初歩的なため、教えていただけると助かります。
回答を見る
  • ベストアンサー

PHPのconfigureのオプションにつきまして

日頃WindowsメインでLinuxをあまり使わない者です。 今回、とある理由でCentOS5.5にPHP5.2とMySQL4.0の環境を作る必要が出てきました。それで、それらをソースからコンパイルしてインストールしてみたのですが、PHPのmysql_connect()で以下のようなエラーが出て、原因がわからず困っています。 Can't connect to local MySQL server through socket '/tmp/mysql.sock' (13) PHPもMySQLも単体では正常に動いているようです。データベースも作れました。 それで色々調べていたのですが、/tmp/mysql.sockのアクセス権限を777にしたり、 PHPとMySQLが/tmp/mysql.sockを介する設定になっているかを確認しましたが、いずれも問題無さそうです。 それで、phpinfo()の結果をさくらサーバーのそれと比べてみたところ、 Configure Commandのところが全然違うことがわかりました。 今回構築した環境では、 './configure' '--with-apxs2=/usr/sbin/apxs' '--with-mysql=/usr/local/mysql' ですが、 さくらサーバーは、 './configure' '--prefix=/usr/local/php/5.2' '--with-config-file-path=${prefix}/etc' '--with-config-file-scan-dir=${prefix}/etc/conf.d' '--enable-force-cgi-redirect' '--with-openssl=/usr/local/ssl' '--with-zlib=/usr' '--with-curl' '--enable-exif' '--with-pcre-dir=/usr/local' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-ttf' '--with-freetype-dir=/usr/local' '--with-gettext=/usr/local' '--with-gmp=/usr/local' '--with-iconv=/usr/local' '--enable-mbstring' '--with-mcrypt' '--with-mysql=/usr/local' '--with-mysqli=/usr/local/bin/mysql_config' '--with-pdo-mysql=/usr/local' '--with-snmp=/usr/local' '--enable-soap' '--with-xsl=/usr/local' '--enable-zip' と非常に多いです。 これらは関係あるでしょうか。初歩的な質問で恐縮ですが、ご存知の方がいらっしゃいましたら、ご教示いただけましたら助かります。 よろしくお願いします。

  • PHP
  • 回答数1
  • ありがとう数1

質問者が選んだベストアンサー

  • ベストアンサー
  • t_ohta
  • ベストアンサー率38% (5067/13241)
回答No.1

/tmp ディレクトリのアクセス権限は合っていますか? configure オプションの数は関係ありませんが、mbstring などは必要になるんじゃないかと思うので、追加しておいた方がいいでしょうね。 他のオプションは必要なモノだけチョイスして有効にすればいいのですが、オプションを有効にするためには関係するライブラリのインストールも必要になるので注意しましょう。

spaceman18
質問者

お礼

早速教えていただきありがとうございます。/tmpは1777となっていました。これは問題ないように思いましすが、いかがでしょう。。mbstringさっそく入れました。

関連するQ&A

  • php-5.3.3のconfigureでエラー

    RHEL6にPHP5.3.3をソースインストール(訳あってrpmを使えない)しようとすると 下記のエラーが出て困ってます。 configure: error: DBA: Could not find necessary header file(s). configureは下記を指定してます。RHEL5.5ではOKだったのに6では通らない。 インストールされているパッケージが原因かと思っているのですが、情報が 見当たらず前に進めません。 同じ状況になった方助言をお願いします。 OS:Red Hat Enterprise Linux Server release 6.0 (Santiago) PHP:php-5.3.3.tar.gz configure:./configure \ --enable-track-vars \ --enable-trans-sid \ --with-mysql=/usr/local/mysql \ --with-gdbm \ --disable-debug --with-apxs2=/usr/local/apache/bin/apxs \ --enable-mbstring \ --enable-mbstr-enc-trans \ --with-mcrypt=/usr/local/lib \ --with-ldap=/usr ※Apache2、mysql、mcryptは正常にインストールされてます。 宜しくお願いします。

  • お使いの PHP MySQL ライブラリのバージョン 4.1.22 が

    お使いの PHP MySQL ライブラリのバージョン 4.1.22 が MySQL サーバのバージョン 5.1.48 と異なります。これは予期しない不具合を起こす可能性があります。 お世話になります。 RHLE4でPHP4 から PHP5.2.9へのアップグレードが完了しMySQLのバージョンも5.1.48にアップグレードしました。 インストールは問題なく終了しPHPからMySQLのアクセスも可能となっております。 しかし、phpMyAdminからMySQLにアクセスしようとすると、 【お使いの PHP MySQL ライブラリのバージョン 4.1.22 が MySQL サーバのバージョン 5.1.48 と異なります。これは予期しない不具合を起こす可能性があります。】 と表示されてしまいます。 PHPのライブラリバージョンを上げれば問題ないと思うのですが、 どうしてもバージョンがアップできません。 参考になるサイトややり方がわかる方がいたら教えていただけますでしょうか。 ■PHPのコンパイルオプション ./configure \ --prefix=/usr/local/php5 \ --with-config-file-path=/usr/local/php5/lib \ --enable-sigchild \ --enable-mbstring \ --enable-mbregex \ --enable-force-cgi-redirect \ --enable-zend-multibyte \ --with-gd \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-zlib \ --with-zlib-dir=/usr \ --with-openssl \ --enable-ftp \ --with-curl \ --with-mysql=/usr/local/mysql5 \ --with-pdo-mysql=/usr/local/mysql5 \ --with-pgsql=/var/lib/pgsql ■MySQLのコンパイルオプション ./configure --prefix=/usr/local/mysql5 \ --localstatedir=/usr/local/mysql5/data \ --enable-assembler \ --with-client-ldflags=-all-static \ --with-mysqld-ldflags=-all-static \ --with-charset=utf8 \ --with-extra-charsets=all \ --with-tcp-port=3308 \ --with-unix-socket-path=/tmp/mysql5.sock \ --with-plugins=innobase

    • 締切済み
    • PHP
  • PHPのCGIモードとについて

    PHPのCGIモードとについて PHPのCGIモードというのがよく分かりません。 自分はcentOSにソースコードからPHPを入れております。 で、主にApacheと連携させています。 ただ、最近は #!/usr/local/bin/php -q などを最初に書いてコマンドラインからの使用が多くなっております。 自分は ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-freetype-dir=/usr/local/lib --with-gd --with-mysqli=/usr/local/mysql5.5/bin/mysql_config --with-pdo-mysql=/usr/local/mysql5.5 --with-mysql-sock=/var/lib/mysql/mysql.sock --with-zlib --with-xsl=/usr/lib --enable-mbregex --enable-mbstring --enable-bcmath --with-mcrypt --disable-posix-threads --enable-bcmath --with-readline --with-curl=/usr/local/curl --with-curlwrappers --with-openssl --with-openssl-dir=/usr/lib64/openssl --enable-pcntl のようにしているのですが、これでCGIモードにはなっているのでしょうか? いまいち概念が掴めないでおります。 具体的な事例や、CGIモードでない場合との違いなどを教えていただけないでしょうか? また、CGIモードにするために何かphp.ini等で設定をするような事があるのであれば、 どのようにしてCGIモードとして使えるようになるのかをアドバイスいただきたいと思います。

    • ベストアンサー
    • PHP
  • phpのConfigure Commandについて

    ocnのサーバーにphpをvinstallでインストールしたのですが ocn標準で用意されているのは、データベースへアクセスする言語としてのみ利用できる内容になっているようです。 その後のカスタマイズは可能なので、機能を増やしたいのです。 参考になるか分かりませんが、 phpinfo()で表示させると、configure commandの内容が ./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-config-file-path=/usr/local/lib' '--disable-debug' '--enable-memory-limit' '--enable-zend-multibyte' '--with-regex=system' '--enable-mbstring=all' '--enable-mbregex' '--enable-dio' '--enable-calendar' '--enable-versioning' '--with-bz2=shared,/usr' '--enable-sockets=shared' '--with-pcre-regex=/usr/local' '--with-iconv=shared,/usr/local' '--with-gdbm=shared' '--with-db3=shared,/usr/local' '--with-gettext=/usr/local' '--with-curl=shared,/usr/local' '--with-openssl=shared,/usr' '--with-pgsql=shared,/usr/local' '--with-openssl=/usr' '--with-gd=shared' '--enable-gd-native-ttf=shared' '--with-freetype-dir=shared,/usr/local' '--with-ttf=shared,/usr/local' '--with-xpm-dir=/usr/X11R6' '--with-jpeg-dir=shared,/usr/local' '--with-png-dir=shared,/usr/local' '--with-t1lib=shared,/usr/local' '--with-zlib=/usr' こんな感じになっています。 この内容で分かりますか? どなたかご教授宜しくお願いいたします。

  • phpインストールについて

    CentOS5.0にphp5.2系をmakeし、インストールを 行いました。 その後の確認を行ったときにhttpを再起動したのですが 起動されません。 (httpはCentOSに入っているものを使用しています。) phpをインストールする前は問題なく起動できていました。 httpのerrorログを見ると Directory index forbidden by Options directive: /var/www/html/ のエラーがでていました。 /var/www/html/自体は存在しますしhttpd.confにも設定しています。 ちなみにphpのコンパイルは ./configure --with-apxs2=/usr/sbin/apxs \ --prefix=/usr/local \ --with-mysql=/usr/lib/mysql \ --enable-mbstring \ --with-gd \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-zlib-dir=/usr \ --with-pear \ --with-openssl で行いました。 どこから調査すればよいのでしょうか?

    • 締切済み
    • PHP
  • PHPモジュールが読み込めない?

    Linuxでサーバーを構築しようと思い、三日三晩試行錯誤してみたのですがどうしてもわからない事があるので質問させていただきます。 Apache、PHPのインストールはエラーなく行えたのですがPHPのインストール後、httpd.confにAddModule文を追加するとApache再起動時に指定したモジュールが見つからない節のエラーが出ます。 ApacheのModuleディレクトリやLibディレクトリ等を探してみたのですが.soファイルが見つかりません。 phpのconfigure時に「CGIとして動作します」的なメッセージが表示されてたのですがそのせいでしょうか? ./configure --prefix=/usr/local/php-5.2.1\ --enable-mbstring\ --with-apxs2=/usr/local/httpd/bin/apxs\ --with-mysql=/usr/local/mysql\ --with-gd --with-zlib --with-jpeg-dir 実行環境 FedoraCore6 Apache-2.2.4 PHP-5.2.1 PHP-4.4.6でもためしてみたのですがうまくいきませんでした。 どなたか原因がわかる方がいたらご教授お願いできませんでしょうか? 初歩的な事で申し訳ないのですがよろしくお願いします。

    • ベストアンサー
    • PHP
  • PHPの4.4.9と5.2.13の共存について。

    PHPの4.4.9と5.2.13の共存について。 OSはRHLE4で既存で動いているPHP4のプログラムがあります。 今回、開発してもらったPHP5のプログラムを同じサーバで動作させようと思っております。 既にPHP5.2.9が入っておりましたが、オプションでMySQLがなかったため、 PHP5をアンインストールして、ソースからコンパイルしてインストールしhttpdを再起動しました。 しかし、phpinfo()で確認したところ、PHPのVersionが5.2.9のまま変化ありません。 ソースからのインストールが初心者なもので大変申し訳御座いませんが、 PHP4と5の共存とソースからインストールした際のアンインストール方法を教えていただけますでしょうか? インストール方法は下記サイトを参考にPHP5バージョンで行ないました。 http://d.hatena.ne.jp/shogo0809/20100714/1279110673 ./configureオプションは下記です。 --prefix=/usr/local/php5 \ --with-config-file-path=/usr/local/php5/lib \ --with-sqlite \ --with-mysql=/usr/local/mysql5 \ --enable-sigchild \ --enable-mbstring \ --enable-mbregex \ --enable-force-cgi-redirect \ --enable-zend-multibyte \ --with-gd \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-zlib \ --with-zlib-dir=/usr \ --with-openssl \ --enable-ftp \ --with-curl \ --with-pgsql=/var/lib/pgsql

    • ベストアンサー
    • PHP
  • PHPのconfigureでmysqlエラーが

    CentOS 5 x86_64上でapache+php+mysqlのサーバ構築中ですが、どうもうまくいきません。 apacheとphpでconfigureのオプションを付けてインストールしたいので、rpm -eでhttpdとphpをアンインストールしたうえで、apacheとphpをmake installしようとしました。 apacheはうまくinstallできたのですが、phpはconfigureでエラーが出てしまいます。 以前Cent OS 5.2(32bit)でやった時は問題なかったのですが・・・ ↓configure時のエラーメッセージ -------------------- checking for mSQL support... no checking for MSSQL support via FreeTDS... no checking for MySQL support... yes checking for specified location of the MySQL UNIX socket... no checking for MySQL UNIX socket location... /var/lib/mysql/mysql.sock checking for mysql_close in -lmysqlclient... no checking for mysql_error in -lmysqlclient... no configure: error: mysql configure failed. Please check config.log for more information. -------------------- ↓config.logのエラーメッセージ -------------------- configure:60440: checking for mysql_error in -lmysqlclient configure:60459: gcc -o conftest -I/usr/include -g -O2 -Wl,-rpath,/usr/lib/mysql -L/usr/lib/mysql -L/usr/lib -Wl,-rpath,/usr/kerberos/lib64 -L/usr/kerberos/lib64 -Wl,-rpath,/usr -L/usr conftest.c -lmysqlclient -lz -lfreetype -lpng -lz -ljpeg -lcurl -lz -lresolv -lm -ldl -lnsl -lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lcurl -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lidn -lssl -lcrypto -lz -lxml2 -lz -lm 1>&5 /usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.so when searching for -lmysqlclient /usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.a when searching for -lmysqlclient /usr/bin/ld: cannot find -lmysqlclient collect2: ld returned 1 exit status configure: failed program was: #line 60448 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char mysql_error(); -------------------- ↓apacheのconfigure ------------------------- ./configure --enable-layout=Apache --disable-autoindex --disable-status --disable-userdir --enable-modules=so --enable-mods-shared=max --enable-ssl --with-ssl=/usr/share/ssl --enable-rewrite=shared --enable-ext-filter ------------------------- ↓phpのconfigure ------------------------- ./configure --with-apxs2=/usr/local/apache2/bin/apxs --enable-mbstring --enable-mbregex --enable-gd-native-ttf --with-gd --with-ttf --with-jpeg-dir --with-freetype-dir --with-png-dir --with-zlib --with-curl --with-openssl --with-mysql ------------------------- バージョンは apache:2.2.11 php:5.2.10, 5.3.0の両方で試しましたが結果は同じ mysql-5.0.45-7.el5.x86_64 mysql-devel-5.0.45-7.el5.x86_64 です。 どなたかご教授いただけますと助かります・・・

  • PHPのconfigureについて

    PHP5.2.6をインストールしようとしているのですが、configureコマンドの所で躓いています 実行しているconfigureオプションは以下の通りです。 ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-gd --with-zlib --enable-bcmath --enable-mbregex --enable-mbstring とすると configure: error: libpng.(a|so) not found. となります。 yum install libpngとすると Package 2:libpng-1.2.10-7.1.el5_3.2.i386 already installed and latest version となるので最新版のようです。 このconfigure: error: libpng.(a|so) not found.を克服する術を教えて頂けると助かります。 何卒よろしくお願いします。

    • ベストアンサー
    • PHP
  • Apache OpenSSL PHP でエラー

    CentOS 5.1にOpenSSL-0.9.8g、httpd-2.0.61、Postgres8.1.10、php-5.2.5でWEBサーバを作っているのですが、不思議なエラーが出てうまくいきません。 現象としては以下の通りです。 htdocs_http = httpコンテンツ htdocs = httpsコンテンツ apacheをstartsslで起動して、htdocsにphpinfoを 出力するプログラムを作成した後アクセスすると コンテンツのTOPに Keep-Alive: timeout=15, max=98 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html ae03 などのメッセージが出力されます。 Apacheとphpを何度も再インストールしたのですが解決できません。 誰か似たような現象を起こった方や、 解決策を知っている方教えていただけませんか。 インストールした順は以下の通りです。 1. OpenSSL 2. httpd 3. Postgres 4. php インストールしたオプション 1. OpenSSL # ./config -fPIC shared 参考にしたサイト http://uguisu.skr.jp/Windows/apache2.html 2. Apache # ./configure \ # --enable-so --enable-ssl --with-ssl=/usr/local/ssl 3. Postgres # ./configure のみのオプションなし。 4. php # ./configure \ # --enable-mbstring=all --enable-mbregex \ # --enable-sockets --enable-ftp \ # --with-apxs2=/usr/local/apache2/bin/apxs \ # --with-pgsql=/usr/local/pgsql --without-mysql \ # --with-gd --enable-gd-native-ttf \ # --with-freetype-dir=/usr --with-jpeg-dir=/usr \ # --with-zlib=/usr --with-png-dir=/usr \ # --with-imap=/usr --with-kerberos=/usr \ # --with-imap-ssl --with-pdo-pgsql=/usr/local/pgsql \ # --with-mcrypt=/usr/local

    • 締切済み
    • PHP

専門家に質問してみよう