在CentOS 5.4上启动和运行PHP 5.3的最佳方法是什么? 我的机器说我安装了PHP 5.3但遇到了我的脚本问题 致命错误:第45行/var/www/html/lib/rb.php中未找到“PDO”类 它无法尝试在RedbeanPHP 3.0库中新建一个PDO类。
如何修复此缺失的PDO问题?
我试着按照这些说明操作: 来自http://www.computingunplugged.com/issues/issue201102/00002619002
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 pecl install pdo
sudo pecl install pdo_mysql
然后,您需要将以下内容添加到php.ini文件的末尾。根据您安装的PHP版本,它们将是/etc/php5/apache2/php.ini,/etc/php5/cgi/php.ini和/etc/php/cli/php.ini。
延长= pdo.so
延长= pdo_mysql.so
“
现在我在尝试运行sudo pecl install pdo_mysql时得到一个mysql_query_missing 并且不确定如何通过这个。
答案 0 :(得分:2)
您还必须安装php-pdo软件包。
编辑:也许这也有帮助:How do I enable PDO using CentOS?
答案 1 :(得分:1)
我已成功在CentOS 5.4 Linux上安装PHP-5.3。我需要这个能够成功安装和运行Drupal 7 - 这对我来说也很有用。以下是详细信息:
这是我在ServerFault中写的答案的副本:https://serverfault.com/a/392168/29205
解决方案基于以下接受的答案:
总结:转到php5.3。
原因:由于安全问题而删除了对php5.2的支持,正如其他问题的答案所解释的那样。此删除导致依赖项版本不匹配,从而导致出现错误。
<强>背景强>
我想在CentOS 5.4机器上运行Drupal 7。所以我需要5.3版本的PHP。
以下是截至2012年5月24日使用工作存储库升级到PHP 5.3的完整工作步骤(我提供的评论以#开头 - 您不需要这些,只是为了您的信息)
# 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