安装完成后,进入/usr/local/apache243/目录下,检查是否有以下文件:
bin build cgi-bin error htdocs icons include logs man manual modules
启动Apache服务器,并查端口是否开启,启动Apache服务器的命令行如下:
#/usr/local/apache243/bin/apachectl start
提示信息:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
解决方案:
vi /etc/httpd/httpd.conf
加上下面一行,重启apache
ServerName localhost:80
3.9 安装mysql数据库
步骤:
1、增加用户名和用户组
#groupadd mysql
#useradd -g mysql mysql
2、进入源码包使用configure 检查并配置安装需要的系统环境,并生成安装配置文件
#./configure \
>--prefix=/usr/local/mysql \ //将软件安装在/usr/local/mysql目录下
>--enable-thread-safe-client \
>--with-extra-charsets=all //在安装mysql时安装所有字符集
make
make install
如果遇到错误信息:
checking for tgetent in -lncurses... no
checking for tgetent in -lcurses... no
checking for tgetent in -ltermcap... no
checking for termcap functions library... configure: error: No curses/termcap library found
原因:缺少ncurses安装包
解决方案:
执行下面三行命令,执行完之后重新./configure(配置)
yum list|grep ncurses
yum -y install ncurses-devel
yum install ncurses-devel
接着#make && make install
5、将程序二进制的所有权改为root用户,数据目录的所有权改为运行mysqld程序的mysql用户。如果现在位于安装目录(/usr/local/mysql)下,命令行如下:
[iyunv@localhost mysql]# chown -R root . (注意有点) //将文件的所有属性改为root用户
[iyunv@localhost mysql]# chown -R mysql var //将数据目录的所有属性改为mysql用户
[iyunv@localhost mysql]# chgrp -R mysql . (注意有点)//将组属性改为mysql组
[iyunv@localhost mysql]# ls -l
total 40
drwxr-xr-x. 2 root mysql 4096 Feb 7 20:50 bin
drwxr-xr-x. 3 root mysql 4096 Feb 7 20:50 include
drwxr-xr-x. 2 root mysql 4096 Feb 7 20:50 info
drwxr-xr-x. 3 root mysql 4096 Feb 7 20:50 lib
drwxr-xr-x. 2 root mysql 4096 Feb 7 20:50 libexec
drwxr-xr-x. 3 root mysql 4096 Feb 7 20:50 man
drwxr-xr-x. 7 root mysql 4096 Feb 7 20:50 mysql-test
drwxr-xr-x. 3 root mysql 4096 Feb 7 20:50 share
drwxr-xr-x. 5 root mysql 4096 Feb 7 20:50 sql-bench
drwx------. 4 mysql mysql 4096 Feb 7 20:53 var
6、在所需要的东西被安装完成后,应当使用下面的命令启动MySQL服务了,命令行如下:
[iyunv@localhost mysql]#/usr/local/mysql/bin/mysqld_safe --user=mysql &
报告信息(不理会):
[iyunv@localhost mysql]# /usr/local/mysql/bin/mysqld_safe --user=mysql &
[1] 4720
[iyunv@localhost mysql]# nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /usr/local/mysql/var
8、使用mysqladmin验证服务器在运行中。以下命令提供了简单的测试,可检查服务器是否已经开启并能响应连接。命令行如下:
[iyunv@localhost mysql]# bin/mysqladmin version
Enter password:
bin/mysqladmin Ver 8.41 Distrib 5.0.18, for pc-linux-gnu on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 5.0.18-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 18 min 59 sec
Threads: 1 Questions: 3 Slow queries: 0 Opens: 0 Flush tables: 1 Open tables: 6 Queries per second avg: 0.003
[iyunv@localhost mysql]# bin/mysqladmin variables //查看所有mysql参数
9、设置访问权限,在mysql安装过程中,使用mysql_install_db程序安装了mysql数据库授权表,表定义了初始mysql用户 账户和访问权限,所有初始化账户均没有密码。这些账户为超用户账户,可以执行任何操作。初始root账户的密码为空,因此任何人可以用root账户不用任 何密码来连接mysql服务器,并具有所有权限,这意味着mysql安装未受保护。如果你想要防止客户端不使用密码用匿名用户来连接,你应当为匿名账户指 定密码或删掉匿名帐户,应当为mysql root账户指定密码。使用mysql -u root启动mysql客户端控制台,连接mysql服务器。命 令行如下:
[iyunv@localhost mysql]# bin/mysql -u root //没有密码可直接登录本机服务器
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 5.0.18-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
10、如果有匿名账户存在,它拥有全部的权限,因此删掉它可以提高安全,在mysql客户端执行SQL语如下:
mysql> delete from mysql.user where host='localhost' and user='';
Query OK, 1 row affected (0.01 sec)
11、可以用几种方法为root账户指定密码,我们选择用其中的一种。在mysql客户端命令行上使用set password指定密码,一定要使 用password()函数来加密密码。例如下面设置localhost域的密码为ios100。其他域可以使用同样的语句,使用的SQL语句如下。
mysql> set password for 'root'@'localhost'=password('你要设置的密码');
Query OK, 0 rows affected (0.00 sec)
12、如果想退出mysql客户端,可以在mysql客户端提示符下输入命令exit或者quit,还可以按键盘ctrl+c组合键,都可以从 mysql客户端退出。因为已经给mysql服务器的root账号设置了密码,所以再次登录mysql客户端就要提供密码才能进入。退出mysql客户端 和重新启动mysql客户端的控制台命令如下。
mysql> exit
Bye
[iyunv@localhost mysql]# bin/mysql -u root -h localhost -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 5.0.18-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
如果想关闭mysql服务器,在命令行使用mysql服务器的mysqladmin命令,通过-u参数给出mysql数据库管理员用户名root和通过-p参数给出密码,即可关闭mysql服务器。如下示:
[iyunv@localhost mysql]# bin/mysqladmin -u root -p shutdown
Enter password:
STOPPING server from pid file /usr/local/mysql/var/localhost.pid
130207 21:27:05 mysqld ended
[1]+ Done /usr/local/mysql/bin/mysqld_safe --user=mysql
配置时可能会出现下面的错误:
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
configure: error: Cannot find libmysqlclient_r under /usr/local/mysql. Note that the MySQL client library is not bundled anymore!
其实这跟PHP没有关系,那是因为在编译APACHE的时候,使用--with-mpm模块,所以就必须在编译MYSQL的时候加上 --enable-thread-safe-client.参数
这是PHP5.2的一个改进,在PHP5.2.0之前的版本都不需要MYSQL启用安全线程。关于--enable-thread-safe- client项的官方介绍如下:如何生成线程式客户端库总是线程安全的。最大的问题在于从套接字读取的net.c中的子程序并不是中断安全的。或许你可能 希望用自己的告警中断对服务器的长时间读取,以此来解决问题。如果为SIGPIPE中断安装了中断处理程序,套接字处理功能应是线程安全的。 SupeSite/X-为了避免连接中断时放弃程序,MySQL将在首次调用mysql_server_init()、mysql_init()或 mysql_connect()时屏蔽SIGPIPE。如果你打算使用自己的SIGPIPE处理程序,首先应调用 mysql_server_init(),然后安装你的处理程序.
还有第二种解决方法比较方便 :编译之前,先处理一下mysql的库,默认查找libmysqlclient_r.so,可是mysql默认为libmysqlclient.so,内容完全一样,做个链接即可
# cd /usr/local/mysql/lib/mysql/
# ln -s libmysqlclient.so.15.0.0 libmysqlclient_r.so
(以上解决方法来自互联网!)
还会报make: *** [ext/gd/gd.lo] error
解决方法如下:
好像说这个错误算是php5.4的bug,下面对应的两篇文章有对应的说明:
https://bugs.php.net/bug.php?id=55224
https://bugs.php.net/bug.php?id=60108
解决方法:
vi <gd_dir>/include/gd_io.h
gdIOCtx结构中增加void *data;
格式如下
typedef struct gdIOCtx
{
int (*getC) (struct gdIOCtx *);
int (*getBuf) (struct gdIOCtx *, void *, int);
/* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! */
int (*seek) (struct gdIOCtx *, const int);
long (*tell) (struct gdIOCtx *);
void (*gd_free) (struct gdIOCtx *);
void (*data);
}
gdIOCtx;
我的GD安装在/usr/local/gd2目录下,所以是#vi vi /usr/local/gd/include/gd_io.h
libltdl.so.3: cannot open shared object file: No such file or directory
make: *** [ext/phar/phar.php] Error 127
解决方法:
ln -s /usr/local/lib/libltdl.so.3 /usr/lib/libltdl.so.3
[iyunv@localhost ~]# cd /usr/local/libpng/lib/
[iyunv@localhost lib]# ls
libpng15.a libpng15.so libpng15.so.15.10.0 libpng.la pkgconfig
libpng15.la libpng15.so.15 libpng.a libpng.so
可以看到libpng15.so.15
然后修改/etc/ld.so.conf 文件:vi /etc/ld.so.conf
在第一行下面追加/usr/local/libpng/lib这个路径。
然后重新编译安装即可。
提示信息:
=====================================================================
=====================================================================
WARNED TEST SUMMARY
---------------------------------------------------------------------
Bug #52062 (large timestamps with DateTime::getTimestamp and DateTime::setTimestamp) (32 bit) [ext/date/tests/bug52062.phpt] (warn: XFAIL section but test passes)
=====================================================================
You may have found a problem in PHP.
This report can be automatically sent to the PHP QA team at
http://qa.php.net/reports and http://news.php.net/php.qa.reports
This gives us a better understanding of PHP's behavior.
If you don't want to send the report immediately you can choose
option "s" to save it. You can then email it to qa-reports@lists.php.net later.
Do you want to send this report now? [Yns]:
解决方案:
不要make test 直接make install