
前提・実現したいこと
centos6でweb開発環境を構築しております。phpの設定を見直していたところ、"php -i"と"psql -V"で表示されるpostgresqlのバージョンが異なることに気づきました。
[root@localhost ~]# php -i | grep PostgreSQL PDO Driver for PostgreSQL => enabled PostgreSQL(libpq) Version => 8.4.20 PostgreSQL Support => enabled PostgreSQL(libpq) Version => 8.4.20 PostgreSQL(libpq) => PostgreSQL 8.4.20 on x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17), 64-bit [root@localhost ~]# psql -V psql (PostgreSQL) 9.6.8
コマンドラインからのpostgresql接続はできています。現在用意したphpファイルでpg_connect()が読み込まれていないエラーが出ており、このバージョンの差異のせいなのかなと思案しています。postgresqlはデフォルトの8.4.20ではなく9.6を使用したいです。どのようにしたら揃えられるでしょうか?
開発環境
CentOS release 6.9 (Final)
Server version: Apache/2.2.15 (Unix)
PHP 7.0.29 (cli) (built: Mar 28 2018 07:19:53) ( NTS )
必要なパッケージはソースではなくyumでインストールしています。
試したこと
バージョンを揃える方法を探していたところ、peclでPDO_PGSQLをインストールしたらよいというのを見かけたので試してみました。
"yum remove php70-php-pgsql"で現在インストールしているpdo_pgsqlを削除し、"php -m"でpdo_pgsqlが消えているのを確認しました。
発生している問題・エラーメッセージ
peclでのインストールはmakeで失敗しているようです。
[root@localhost ~]# pecl install PDO_PGSQL WARNING: "pecl/PDO" is deprecated in favor of "channel://http://svn.php.net/viewvc/php/php-src/trunk/ext/pdo//ext/PDO" downloading PDO_PGSQL-1.0.2.tgz ... Starting to download PDO_PGSQL-1.0.2.tgz (14,961 bytes) .....done: 14,961 bytes downloading PDO-1.0.3.tgz ... Starting to download PDO-1.0.3.tgz (52,613 bytes) ...done: 52,613 bytes 12 source files, building running: phpize Configuring for: PHP Api Version: 20151012 Zend Module Api No: 20151012 Zend Extension Api No: 320151012 building in /var/tmp/pear-build-minoue0KBhq0/PDO-1.0.3 running: /var/tmp/PDO/configure --with-php-config=/opt/remi/php70/root/usr/bin/php-config checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking for cc... cc // 中略 checking whether to build static libraries... no configure: creating ./config.status config.status: creating config.h config.status: executing libtool commands running: make /bin/sh /var/tmp/pear-build-minoue0KBhq0/PDO-1.0.3/libtool --mode=compile cc -I. -I/var/tmp/PDO -DPHP_ATOM_INC -I/var/tmp/pear-build-minoue0KBhq0/PDO-1.0.3/include -I/var/tmp/pear-build-minoue0KBhq0/PDO-1.0.3/main -I/var/tmp/PDO -I/opt/remi/php70/root/usr/include/php -I/opt/remi/php70/root/usr/include/php/main -I/opt/remi/php70/root/usr/include/php/TSRM -I/opt/remi/php70/root/usr/include/php/Zend -I/opt/remi/php70/root/usr/include/php/ext -I/opt/remi/php70/root/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /var/tmp/PDO/pdo.c -o pdo.lo libtool: compile: cc -I. -I/var/tmp/PDO -DPHP_ATOM_INC -I/var/tmp/pear-build-minoue0KBhq0/PDO-1.0.3/include -I/var/tmp/pear-build-minoue0KBhq0/PDO-1.0.3/main -I/var/tmp/PDO -I/opt/remi/php70/root/usr/include/php -I/opt/remi/php70/root/usr/include/php/main -I/opt/remi/php70/root/usr/include/php/TSRM -I/opt/remi/php70/root/usr/include/php/Zend -I/opt/remi/php70/root/usr/include/php/ext -I/opt/remi/php70/root/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /var/tmp/PDO/pdo.c -fPIC -DPIC -o .libs/pdo.o In file included from /var/tmp/PDO/pdo.c:32: /var/tmp/PDO/php_pdo_driver.h: In function 'pdo_attr_lval': /var/tmp/PDO/php_pdo_driver.h:191: error: too many arguments to function 'zend_hash_index_find' /var/tmp/PDO/php_pdo_driver.h:192: warning: passing argument 1 of 'zval_get_type' from incompatible pointer type /opt/remi/php70/root/usr/include/php/Zend/zend_types.h:326: note: expected 'const struct zval *' but argument is of type 'struct zval **' /var/tmp/PDO/php_pdo_driver.h:192: warning: passing argument 1 of 'convert_to_long' from incompatible pointer type /opt/remi/php70/root/usr/include/php/Zend/zend_operators.h:244: note: expected 'struct zval *' but argument is of type 'struct zval **' /var/tmp/PDO/php_pdo_driver.h: In function 'pdo_attr_strval': /var/tmp/PDO/php_pdo_driver.h:201: error: too many arguments to function 'zend_hash_index_find' /var/tmp/PDO/php_pdo_driver.h:202: warning: passing argument 1 of 'zval_get_type' from incompatible pointer type /opt/remi/php70/root/usr/include/php/Zend/zend_types.h:326: note: expected 'const struct zval *' but argument is of type 'struct zval **' /var/tmp/PDO/php_pdo_driver.h:202: warning: passing argument 1 of 'zval_get_type' from incompatible pointer type /opt/remi/php70/root/usr/include/php/Zend/zend_types.h:326: note: expected 'const struct zval *' but argument is of type 'struct zval **' /var/tmp/PDO/php_pdo_driver.h:202: warning: passing argument 1 of '_convert_to_string' from incompatible pointer type /opt/remi/php70/root/usr/include/php/Zend/zend_operators.h:243: note: expected 'struct zval *' but argument is of type 'struct zval **' /var/tmp/PDO/php_pdo_driver.h:203: warning: passing argument 1 of '_estrndup' makes pointer from integer without a cast /opt/remi/php70/root/usr/include/php/Zend/zend_alloc.h:85: note: expected 'const char *' but argument is of type 'int' In file included from /var/tmp/PDO/pdo.c:33: /var/tmp/PDO/php_pdo_int.h: At top level: /var/tmp/PDO/php_pdo_int.h:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'pdo_dbh_new' /var/tmp/PDO/php_pdo_int.h:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'pdo_dbstmt_new' /var/tmp/PDO/php_pdo_int.h:48: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'pdo_row_new' /var/tmp/PDO/pdo.c: In function 'php_pdo_get_exception_base': /var/tmp/PDO/pdo.c:68: warning: passing argument 2 of 'zend_hash_find' from incompatible pointer type /opt/remi/php70/root/usr/include/php/Zend/zend_hash.h:154: note: expected 'struct zend_string *' but argument is of type 'char *' /var/tmp/PDO/pdo.c:68: error: too many arguments to function 'zend_hash_find' /var/tmp/PDO/pdo.c: In function 'zif_pdo_drivers': /var/tmp/PDO/pdo.c:96: warning: passing argument 2 of 'zend_hash_get_current_data_ex' from incompatible pointer type /opt/remi/php70/root/usr/include/php/Zend/zend_hash.h:171: note: expected 'HashPosition *' but argument is of type 'void **' /var/tmp/PDO/pdo.c:96: error: too many arguments to function 'zend_hash_get_current_data_ex' /var/tmp/PDO/pdo.c:97: error: too many arguments to function 'add_next_index_stringl' /var/tmp/PDO/pdo.c: In function 'php_pdo_register_driver': /var/tmp/PDO/pdo.c:165: warning: passing argument 2 of 'zend_hash_exists' from incompatible pointer type /opt/remi/php70/root/usr/include/php/Zend/zend_hash.h:159: note: expected 'struct zend_string *' but argument is of type 'char *' /var/tmp/PDO/pdo.c:165: error: too many arguments to function 'zend_hash_exists' /var/tmp/PDO/pdo.c:171:41: error: macro "zend_hash_add" passed 6 arguments, but takes just 3 /var/tmp/PDO/pdo.c:170: error: 'zend_hash_add' undeclared (first use in this function) /var/tmp/PDO/pdo.c:170: error: (Each undeclared identifier is reported only once /var/tmp/PDO/pdo.c:170: error: for each function it appears in.) /var/tmp/PDO/pdo.c: In function 'php_pdo_unregister_driver': /var/tmp/PDO/pdo.c:176: warning: passing argument 2 of 'zend_hash_exists' from incompatible pointer type /opt/remi/php70/root/usr/include/php/Zend/zend_hash.h:159: note: expected 'struct zend_string *' but argument is of type 'char *' /var/tmp/PDO/pdo.c:176: error: too many arguments to function 'zend_hash_exists' /var/tmp/PDO/pdo.c:180: warning: passing argument 2 of 'zend_hash_del' from incompatible pointer type /opt/remi/php70/root/usr/include/php/Zend/zend_hash.h:146: note: expected 'struct zend_string *' but argument is of type 'char *' /var/tmp/PDO/pdo.c:180: error: too many arguments to function 'zend_hash_del' /var/tmp/PDO/pdo.c: In function 'pdo_find_driver': /var/tmp/PDO/pdo.c:187: warning: passing argument 2 of 'zend_hash_find' from incompatible pointer type /opt/remi/php70/root/usr/include/php/Zend/zend_hash.h:154: note: expected 'struct zend_string *' but argument is of type 'char *' /var/tmp/PDO/pdo.c:187: error: too many arguments to function 'zend_hash_find' /var/tmp/PDO/pdo.c: In function 'zm_startup_pdo': /var/tmp/PDO/pdo.c:323: error: too many arguments to function 'zend_register_internal_class_ex' /var/tmp/PDO/pdo.c: In function 'zm_info_pdo': /var/tmp/PDO/pdo.c:371: warning: passing argument 2 of 'zend_hash_get_current_data_ex' from incompatible pointer type /opt/remi/php70/root/usr/include/php/Zend/zend_hash.h:171: note: expected 'HashPosition *' but argument is of type 'void **' /var/tmp/PDO/pdo.c:371: error: too many arguments to function 'zend_hash_get_current_data_ex' make: *** [pdo.lo] Error 1 ERROR: `make' failed
長くなりましたが、知りたいのは以下になります。
- "php -i"と"psql -V"で表示されるpostgresqlのバージョンを揃える方法
- もしpeclを使った方法が方向性として正しいのであれば、現在出ているmakeエラーの解決方法
何か足りない情報などありましたらご指摘ください。よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー