js333 > 计算机互联网 > RedHat Linux 5 安装 PHP

原标题:RedHat Linux 5 安装 PHP

浏览次数:89 时间:2019-11-03

Linux和Windows 差异太大了,windows安装程序的时候自个儿只关切配置,而Linux你则须求关心每一个细节.

环境:

在装置PHP软件以前,有多少个标准亟待满意。如下:

在RedHat Linux 5下安装PHP5 遇到了2个问题

CentOS7 64位

1、rpm -ivh zlib-devel-1.2.3-3.i386.rpm

libxml2从未有过设置

Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

2、rpm -ivh libxml2-devel-2.6.26-2.1.2.8.i386.rpm

mysql header 未有安装

MySQL详细安装可参谋:

(以上四个包都在奇骏HEL5.5设置光盘的Server目录下)

PHP安装脚本

Apache详细安装可参谋:

接下去,我们就来安装PHP了。

./configure --prefix=/usr/local/php5

 

证实一下,作者的mysql是RPM包安装的,mysql的头文件是mysql.h,它之处是在/usr/include/mysql/目录下。还会有一点,在设置mysql的时候理应要安装四个文件,一个是server,三个是client,多个devel。唯有安装了devel后本领找到头文件mysql.h。

--with-config-file-path=/usr/local/lib

风流倜傥、下载文件

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-xml=/usr/local/libxml2 --with-png=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg6 --with-zlib=/usr/local/zlib --with-freetype=/usr/local/freetype --with-gd=/usr/local/gd2 --with-curl=/usr/local/curl

--with-apxs2=/usr/apache/httpd/bin/apxs

1、php下载地址:  版本:php-5.6.3.tar.gz

#make

--with-mysql=/usr/include/mysql

2、libxml2下载地址:  版本:libxml2-2.7.4.tar.gz

#make install

make

3、apache2下载地址:  版本:httpd-2.4.10.tar.gz

#make test

make install

4、apr与apr-util下载地址:   版本:apr-1.5.1.tar.gz / apr-util-1.5.4.tar.gz

配置php.ini文件

============================

5、pcre下载地址:  版本:pcre-8.36.tar.gz

因为自身用的php-5.3.8.tar.gz这一个本子,它解压今后会有多个公文php.ini-development,php.ini-production。

率先个难点libxml2还没安装,只可以将系统盘找来,在Server目录下找到该rpm安装

6、MySQL下载地址:  

把php.ini-development文件复制到php的安装目录下的/usr/local/php/lib下并校正文件名,更改为php.ini

金沙js333娱乐场 1 

MySQL-devel-community-5.1.73-1.rhel5.x86_64.rpm

安装完未来配置apache的httpd.conf文件

ls *libxml*
/*找到那多个有效的包, libxml2-2.6.23-1.2.i386.rpm libxml2-devel-2.6.23-1.2.i386.rpm */
rpm -ivh libxml2-2.6.23-1.2.i386.rpm
/*提示小编早就安装过了*/
rpm -ivh libxml2-devel-2.6.23-1.2.i386.rpm

MySQL-client-community-5.1.73-1.rhel5.x86_64.rpm

在里头参加

安分守纪提示一路设置依赖的rpm

MySQL-server-community-5.1.73-1.rhel5.x86_64.rpm

LoadModule php5_module        modules/libphp5.so     //那些模块是在设置php的时候自动写入到httpd.conf文件中的。
AddType Application/x-httpd-php .php                   //那些要求手动增加

继续施行PHP安装脚本照旧那叁个

下载

<IfModule dir_module>
    DirectoryIndex index.html index.html.var index.php
</IfModule>

提示

 

有关借使运维 php程序

=====================

二、安装MySQL

把php程序嵌入apache下的htdocs上边。

configure: error: Cannot find MySQL header files under /usr/include/mysql.
Note that the MySQL client library is not bundled anymore!

1、二进制安装MySQL,步骤如下:

终极重启apache就瓜熟蒂落了

=======================

[root@vm15 mysql]# rpm -ivh MySQL-server-community-5.1.73-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-server-community ########################################### [100%]

 

晕啊,小编最初下载mysql的时候只下载了 server和client,根本不亮堂 MySQL-devel-community-5.1.57-1.rhel5.i386.rpm也许有用滴

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

唯其如此重新到apache下载,安装

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h vm15.example.com password 'new-password'

双重实践PHP安装脚本

Alternatively you can run:
/usr/bin/mysql_secure_installation

金沙js333娱乐场 2

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

日常安装成功咧

See the manual for more instructions.

金沙js333娱乐场 3

Please report any problems with the /usr/bin/mysqlbug script!

金沙js333娱乐场 4

Starting MySQL.. SUCCESS!
Giving mysqld 2 seconds to start

[root@memcache mysql]# rpm -ivh MySQL-client-community-5.1.73-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client-community ########################################### [100%]

[root@vm15 mysql]# rpm -ivh MySQL-devel-community-5.1.73-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-devel-community ########################################### [100%]

 

2、验证安装是或不是成功

[root@vm15 mysql]# rpm -qa |grep MySQL
MySQL-client-community-5.1.73-1.rhel5.x86_64
MySQL-devel-community-5.1.73-1.rhel5.x86_64
MySQL-server-community-5.1.73-1.rhel5.x86_64

 

[root@vm15 mysql]# mysql

现身了“mysql>”提示符,恭喜您,安装成功!

 

三、安装Apache

参考:

 

四、安装libxml2

将下载的libxml2-2.7.4.tar.gz文件上传至/usr/local

[root@vm15 local]# mkdir -p libxml2
[root@vm15 local]# tar -zxvf libxml2-2.7.4.tar.gz
[root@vm15 local]# cd libxml2-2.7.4
[root@vm15 libxml2-2.7.4]# ./configure --prefix=/usr/local/libxml2
[root@vm15 libxml2-2.7.4]# make
[root@vm15 libxml2-2.7.4]# make install

假定设置成功之后,在/usr/local/libxml2/目录下将生成bin、include、lib和share四个目录。在末端安装PHP5源代码包的计划时,会透过在configure命令的选项中加多"--with-libxml-dir=/usr/ local/libxml2"选项,用于指定安装libxml2库文件之处。

 

五、安装php

将下载的php-5.6.3.tar.gz文件上传至/usr/local

[root@vm15 local]# mkdir -p php
[root@vm15 local]# tar -zxvf php-5.6.3.tar.gz
[root@vm15 local]# cd php-5.6.3
[root@vm15 php-5.6.3]#./configure --prefix=/usr/local/php --with-mysql --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml-dir=/usr/local/libxml2

那边供给补充一下 英特网基本是那样子

新兴总是数据库现身了些难题假使链接不上数据库能够是尝试那些:

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql --with-mysqli --with-pdo-mysql --with-apxs2=/usr/local/apache2/bin/apxs --with-gd --with-jpeg-dir --with-png-dir --enable-mbstring --enable-xml --with-xpm-dir=/usr --enable-fpm --with-freetype-dir --with-mcrypt --with-mhash  --with-gettext --enable-pdo --with-libxml-dir --with-zlib-dir

并发以下新闻表示编写翻译成功

..
checking for external oniguruma... no
checking for mcrypt support... no
checking for MSSQL support via FreeTDS... no
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
configure: error: Cannot find MySQL header files under /usr/local/mysql.
Note that the MySQL client library is not bundled anymore!

creating libtool
appending configuration tag "CXX" to libtool

Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands

[root@vm15 php-5.6.3]#make

[金沙js333娱乐场,root@vm15 php-5.6.3]#make install

设置成功。

 

六、配置php

1、配置php.ini,只须求把php-5.6.3安装包中的php.ini-production拷贝到/usr/local/php/lib/下

[root@vm15 php-5.6.3]# cp php.ini-production /usr/local/php/lib/php.ini

2、配置 httpd.conf 让apache支持PHP:

# vi /usr/local/apache/conf/httpd.conf

找到 AddType application/x-gzip .gz .tgz 在其下增添如下内容

AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

3、在DirectoryIndex增加 index.php,以便Apache识别PHP格式的index

# vi /usr/local/apache/conf/httpd.conf

<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>

七、重启Apache

[root@vm15 mysql]# /usr/local/apache2/bin/apachectl start

(一定要重启)

 

八、测量试验php是不是中标安装

写一个php测试页info.php,放到/usr/local/apache2/htdocs中。

<?php

phpinfo();

?>;

在浏览器中输入:服务器地址/info.php。通过phpinfo()能够查阅超多消息,举个例子php.ini的存放路线,以及有着扩张组件等,很有力。

 

假诺能健康展现出php的新闻,则表达Apche+Mysql+PHP安装成功!

 

九、安装际遇的标题

1、安装MySQL时,报上面包车型客车荒唐:

[root@memcache mysql]# rpm -ivh MySQL-server-community-5.1.73-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
file /usr/share/mysql/charsets/README from install of MySQL-server-community-5.1.73-1.rhel5.x86_64 conflicts with file from package mysql-libs-5.1.73-3.el6_5.x86_64
file /usr/share/mysql/charsets/Index.xml from install of MySQL-server-community-5.1.73-1.rhel5.x86_64 conflicts with file from package mysql-libs-5.1.73-3.el6_5.x86_64
file /usr/share/mysql/charsets/armscii8.xml from install of MySQL-server-community-5.1.73-1.rhel5.x86_64 conflicts with file from package mysql-libs-5.1.73-3.el6_5.x86_64
file /usr/share/mysql/charsets/ascii.xml from install of MySQL-server-community-5.1.73-1.rhel5.x86_64 conflicts with file from package mysql-libs-5.1.73-3.el6_5.x86_64
file /usr/share/mysql/charsets/cp1250.xml from install of MySQL-server-community-5.1.73-1.rhel5.x86_64 conflicts with file from package mysql-libs-5.1.73-3.el6_5.x86_64
file /usr/share/mysql/charsets/cp1251.xml from install of MySQL-server-community-5.1.73-1.rhel5.x86_64 conflicts with file from package mysql-libs-5.1.73-3.el6_5.x86_64
file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-community-5.1.73-1.rhel5.x86_64 conflicts with file from package mysql-libs-5.1.73-3.el6_5.x86_64

缓和方式:yum remove mysql-libs-5*

 

2、configure php时,报错:

Configuring SAPI modules
checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS... configure: error: You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropriate switch --with-apxs2

缓慢解决格局:./configure --prefix=/usr/local/php --with-mysql --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml-dir=/usr/local/libxml2

 

3、安装apr时,报错rm: cannot remove `libtoolT': No such file or directory

化解方式:

直白张开/usr/local/apr-1.5.1/configure 把 $RM“$cfgfile” 那行删除掉
$RM“$cfgfile” 大约在 42302行

[root@vm15 apr-1.5.1]#grep -n RM configure

[root@vm15 apr-1.5.1]#sed -i '/$RM "$cfgfile"/d' configure

接下来再重复运转 ./configure --prefix=/usr/local/apr 就能够了.

 

4、[root@vm15 php-5.6.3]#./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml-dir=/usr/local/libxml2

..
checking for external oniguruma... no
checking for mcrypt support... no
checking for MSSQL support via FreeTDS... no
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
configure: error: Cannot find MySQL header files under /usr/local/mysql.
Note that the MySQL client library is not bundled anymore!

减轻格局:

[root@localhost php-5.5.6]# find / -name mysql.h
/usr/include/mysql/mysql.h

招来到mysql.h文件,我们校正参数为--with-mysql,若无的话,存候装mysql-devel包,

本文由js333发布于计算机互联网,转载请注明出处:RedHat Linux 5 安装 PHP

关键词:

上一篇:7一键包失败的解决方法,Client找不到库libjpeg和

下一篇:没有了