当使用phpize的时候出现Can't find PHP headers in /usr/include/php The php-devel package is required for use o
2017-11-08 11:03
525 查看
因为要在 CentOS 用 PHP 操作 Oracle 数据库,要安装新的 PHP 扩展 oci8 。
关于安装 PHP 扩展,以前总以为要重新编译 PHP,今天查阅大量资料发现原来可以像apache模块一样动态扩展。今天就以 oci8 举例。
# cd /root/php-5.5.35/ext/oci8
运行 phpize ,如果不知道 phpize 在哪个目录,可以运行 # which phpize 命令
# /usr/bin/phpize # 这一步可能会出现以下错误
按照字面的意思,可能是你没安装 php-devel 这个扩展包。phpize是用来扩展php扩展模块的,通过phpize可以建立php的外挂模块,phpize 是属于php-devel的内容,所以只要运行yum install php-devel 就行
# yum install php-devel # 却出现以下提示
这说明仓库里默认的 phpize 和 PHP 版本不一致。从下面的命令可以看出:php-devel 版本是 5.3.3 。这就需要我们重新安装 phpize 。
安装与当前 PHP 版本一致的 php-devel 。PHP 版本可以通过 php -v 查看。
所以安装与当前系统 PHP 对应的 php-devel 就可以了。运行 yum install php55w-devel 出现以下信息,安装成功。
# ./configure --with-php-config=/usr/bin/php-config
# make
# make install
安装完后会有这样的东西,Installing shared extensions: /usr/lib64/php/modules 。说明系统已经默认把 oci8.so 模块安装在 /usr/lib64/php/modules 目录中了。
# vi /etc/php.ini
由于我的 CentOS 里 PHP 是以这种方式扩展模块。所以只需在 /etc/php.d 里面添加相应的文件就可以了。
关于PHP扩展,可以通过 phpinfo(); 来查看。
关于安装 PHP 扩展,以前总以为要重新编译 PHP,今天查阅大量资料发现原来可以像apache模块一样动态扩展。今天就以 oci8 举例。
一、进入要安装的扩展的源码目录(没有就到官方下载源代码)
# cd /root/php-5.5.35/ext/oci8运行 phpize ,如果不知道 phpize 在哪个目录,可以运行 # which phpize 命令
# /usr/bin/phpize # 这一步可能会出现以下错误
按照字面的意思,可能是你没安装 php-devel 这个扩展包。phpize是用来扩展php扩展模块的,通过phpize可以建立php的外挂模块,phpize 是属于php-devel的内容,所以只要运行yum install php-devel 就行
# yum install php-devel # 却出现以下提示
这说明仓库里默认的 phpize 和 PHP 版本不一致。从下面的命令可以看出:php-devel 版本是 5.3.3 。这就需要我们重新安装 phpize 。
安装与当前 PHP 版本一致的 php-devel 。PHP 版本可以通过 php -v 查看。
所以安装与当前系统 PHP 对应的 php-devel 就可以了。运行 yum install php55w-devel 出现以下信息,安装成功。
二、运行 /usr/bin/phpize 出现以下信息,说明可以了。
# ./configure --with-php-config=/usr/bin/php-config
# make
# make install
安装完后会有这样的东西,Installing shared extensions: /usr/lib64/php/modules 。说明系统已经默认把 oci8.so 模块安装在 /usr/lib64/php/modules 目录中了。
三,修改php.ini
# vi /etc/php.ini由于我的 CentOS 里 PHP 是以这种方式扩展模块。所以只需在 /etc/php.d 里面添加相应的文件就可以了。
关于PHP扩展,可以通过 phpinfo(); 来查看。
四、重启 Apache
相关文章推荐
- Can't find PHP headers in /usr/include/php
- Linux使用yum安装时出现The program package-cleanup is found in the yum-utils package.解决方法
- Java中TOMCAT下使用JavaBean出现The value for the useBean class attribute is invalid 问题 .
- 使用ntpdate命令同步服务器时间出现“the NTP socket is in use, exiting”
- ros-indigo卸载不全,出现The package <package name> needs to be reinstalled, but I can’t find an archive for
- 使用JSONObject.fromObject的时候出现“There is a cycle in the hierarchy”异常 的解决办法
- Linux使用yum安装时出现The program package-cleanup is found in the yum-utils package.解决方法
- 在ntpdate同步时间的时候出现“the NTP socket is in use, exiting”
- 在使用visual studio 2013写程序时 ,出现了(“The POSIX name for this item is deprecated. Instead, use the ISO C+
- 安装php-gd时出现The program package-cleanup is found in the
- SqlServer2005 恢复数据库时出现Exclusive access could not be obtained because the database is in use 的解决方法
- vs2005下出现“Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive”的解决方法
- git 出现The current branch is not configured for pull No value for key branch.master.merge found in configuration错误的解决办法
- NGINX 运行 PHP正常,运行CGI出现 The page you are looking for is temporarily unavailable 错误
- 指定字符串与主题所要求的形式不符The specified string is not in the form required for a subject
- phprpc Can't find the key for decryption 解决方案
- 关于Can't find following headers in System Include Path警告的问题
- Linux下 ntp 时间同步服务ntpd 出现 the NTP socket is in use, exiting 解决
- IIS运行asp程序出现The requested resource is in use 和 安装.net 2.0 后运行2.0程序出现 Failed to access IIS metabase 错误的解决
- 当使用restore .bak文件的时候.显示如信息:Use WITH MOVE to identify a valid location for the file