首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在CentOS 5.4上运行PHP5.3-找不到致命错误类'PDO‘

在CentOS 5.4上运行PHP5.3-找不到致命错误类'PDO‘
EN

Stack Overflow用户
提问于 2011-12-23 17:26:21
回答 2查看 9.4K关注 0票数 2

在CentOS 5.4上启动和运行PHP5.3的最佳方法是什么。我的机器上说我已经安装了PHP5.3,但是我的脚本遇到了一个严重错误:在第45行的/var/www/html/ lib /rb.php中找不到类' PDO‘,它无法尝试在RedbeanPHP 3.0库中新建一个PDO类。

如何解决这个缺失的PDO问题?

我试着遵循以下说明:来自http://www.computingunplugged.com/issues/issue201102/00002619002

代码语言:javascript
复制
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm  
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm  
# THIS LINE FAILED FOR ME
rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-6.ius.el5.noarch.rpm  

yum erase php php-pear php-mysql php-cli php-common  

yum install php53u php53u-pear php53u-cli php53u-common php53u-gd  
yum install php53u-mbstring php53u-mcrypt php53u-mysql php53u-soap  
yum install php53u-xml php53u-xmlrpc php53u-bcmath  

更新

有人删除了他们的答案。这很好。我要用准确的步骤把它放回去。首先我不得不安装php53u-devel。

引用“

你需要PDO分机。通常安装扩展的最佳方法是通过PECL。

在安装任何PECL扩展之前,需要安装php5-dev包。

sudo安装pdo

数独pecl安装pdo_mysql

然后,您需要将以下内容添加到php.ini文件的末尾。取决于您安装的PHP版本,它们将是/etc/php5/apache2/php.ini、/etc/php 5/cgi/php.ini和/etc/php/cli/php.ini。

extension=pdo.so

extension=pdo_mysql.so

现在,当我尝试运行sudo安装mysql_query_missing时,我得到了一个pdo_mysql

不知道该怎么克服这件事。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-12-23 17:28:43

您还必须安装php包。

编辑:也许这也有帮助:How do I enable PDO using CentOS?

票数 2
EN

Stack Overflow用户

发布于 2012-05-24 13:26:45

我已经成功地在CentOS 5.4Linux上安装了PHP-5.3。我需要这个能够成功地安装和运行Drupal 7-这也为我工作。以下是详细信息:

这是我在ServerFault:https://serverfault.com/a/392168/29205上写的答案的副本

(...for我的问题:https://serverfault.com/questions/391772/php-xml-install-complains-of-dependency-php-common-but-this-is-already-installed/392168#392168 )

解决办法的基础是以下所接受的答案:

https://serverfault.com/questions/391839/how-to-force-centos-yum-to-use-a-later-version-of-a-package-dependency-already-i

摘要:移到php5.3。

原因:对php5.2的支持由于安全问题而被删除,正如该其他问题的公认答案所解释的那样。此删除会导致依赖项的版本不匹配,从而导致所看到的错误。

背景

我想在CentOS 5.4机器上运行Drupal 7。所以我需要5.3版本的PHP。

以下是从2012年5月24日起升级到PHP5.3的完整工作步骤(我在前面给出了#的注释--您不需要这些,只是为了获取您的信息)

代码语言:javascript
复制
# Comment: sites like http://www.computingunplugged.com/issues/issue201102/00002619001
# provide a good start for remedying the problem whereby we need 5.3 on CentOS 5.4 to run Drupal 7. But although their packages worked at the time, the links are now outdated, and updates to these are below.


# comment: (as of May 2012 - the following work, the reason for failures was use of 1) older packages no longer on the server and 2) change of address of one of the servers to dl.fedoraproject.org/pub/epel (credit to: http://osdir.com/ml/centos/2012-03/msg00057.html )

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-10.ius.el5.noarch.rpm  

yum erase php php-pear php-mysql php-cli php-common  

yum install php53u php53u-pear php53u-cli php53u-common php53u-gd  
yum install php53u-mbstring php53u-mcrypt php53u-mysql php53u-soap  
yum install php53u-xml php53u-xmlrpc php53u-bcmath 


# After doing the above, php -v shows 5.3.x But on attempting to install Drupal 7 you may get complaint of something "Your PHP installation is too old 5.1.6 Drupal requires at least PHP 5.2.4. See the system requirements page for more information." and php.info shows the same

# The remedy is to simply restart your apache server

service httpd restart

# credit to following for suggesting service httpd restart :-
# https://serverfault.com/a/207806/29205
# https://serverfault.com/questions/207762/centos-updating-php-via-yum-doesnt-change-the-version-apache-uses

# Drupal 7 install on CentOS 5.4 worked after applying the above steps

# If your MySQL server is not running (check by ps -ef | grep mysql ) then you can run:

/etc/init.d/mysqld

# ...to start it, and to make sure it starts when the machine is restarted or cold booted:

chkconfig mysqld on
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8618908

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档