Ubuntu搭建LAMP环境(安装新版本的Apache服务器)出现问题,执行配置安装httpd时出错

继续在ubuntu下配置PHP开发环境,做到安装Apache服务器了,执行configure的时候,报错,具体如下

configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.

google以后,发现这是需要下载apr和apr-utils 并解压到./srclib/, 再进行编译。

解决办法:

1.1 在上面的链接或者网上下载 apr-1.4.6.tar.gz和apr-util-1.4.1.tar.gz,放到/usr/local/src/目录下,解压软件包到当前目录的apr-1.4.6/和apr-util-1.4.1/下,命令如下:
$ cd /usr/local/usr/                                      // 进入源码包所在目录
$ sudo tar zxvf apr-1.4.6.tar.gz                  // 解压缩
$ sudo tar zxvf apr-util-1.4.1.tar.gz           // 解压缩

1.2 (现在我们依然在/usr/local/src/目录下)拷贝解压缩后的目录到httpd-2.4.4/srclib/apr和httpd-2.4.4/srclib/apr-util中,命令如下:
$ sudo cp -rf apr-1.4.6 httpd-2.4.4/srclib/apr
$ sudo cp -rf apr-util-1.4.1 httpd-2.4.4/srclib/apr-util

然后重新进入httpd目录,进行配置。

结果出现新的问题,如下:
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

又是一个依赖关系,,,,晕死算了。没办法,继续下吧。去http://pcre.org/下载

2.1 在上面的链接或者网上下载 pcre-8.32.tar.gz,放到/usr/local/src/目录下,解压软件包到当前目录的pcre-8.32下,并进入pcre-8.32目录,命令如下:
$ cd /usr/local/usr/                                      // 进入源码包所在目录
$ sudo tar zxvf pcre-8.32.tar.gz                  // 解压缩
$ cd pcre-8.32                                               // 进入目录

2.2 使用“configure”命令检查并配置安装需要的系统环境,并生成安装配置文件,命令行如下:
$ ./configure –prefix=/usr/local/pcre
选项–prefix=/usr/local/pcre作用,是在安装时将软件安装到/usr/local/pcre目录下

2.3 使用make命令编译源码文件并生成安装文件,命令如下:
$ sudo make                                                    // 编译

2.4 使用make install命令进行安装,命令如下:
$ sudo make install                                         // 安装
如果安装成功就会在/usr/local/pcre目录下生成bin、include、lib和share四个目录。如下图
Selection_120

安装完pcre以后,回到httpd目录下,

在./configure的时候加上–with-pcre=/usr/local/pcre即可。

这次终于成功configure了,然后make && make install。

大功告成!

————————————-华丽丽的分割线,下面是英语版——————————————–

English Version:

Continue to install the PHP environment.
An error occured when performing configure command during installing Apache server:

configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.

Google it, I found that we need to download the apr and apr-utils , extract them to ./srclib/ and then compile.

Solution:

1.1 Download the file apr-1.4.6.tar.gz and apr-util-1.4.1.tar.gz on the above link or the official site, put them under /usr/local/src/, and extract them separately to apr-1.4.6/ and apr-util-1.4.1/. The commands as follows:

$ cd /usr/local/usr/            // enter the directory where the source code is
$ sudo tar zxvf apr-1.4.6.tar.gz           // extract the file
$ sudo tar zxvf apr-util-1.4.1.tar.gz      // extract the file

1.2 (remain under the /usr/local/src/)copy the extracted files above separately to directory httpd-2.4.4/srclib/apr/ and httpd-2.4.4/srclib/apr-util/, commands as follows:
$ sudo cp -rf apr-1.4.6 httpd-2.4.4/srclib/apr
$ sudo cp -rf apr-util-1.4.1 httpd-2.4.4/srclib/apr-util

enter the httpd directory to configure.

Another new problem arised:
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

Another dependency?? oops… continue to download~~ go to the website http://pcre.org/.

2.1 Download the file pcre-8.32.tar.gz on the above link or the official site, put it under /usr/local/src/, and extract it to pcre-8.32/, and enter the current directory. The commands as follows:
$ cd /usr/local/usr/            // enter the directory where the source code is
$ sudo tar zxvf  pcre-8.32.tar.gz          // extract the file
$ cd pcre-8.32/                              // enter the current directory

2.2 Check and configure the installation environment with “configure” command, which will generate installation configuration file.  The command line as follows:
$ ./configure –prefix=/usr/local/pcre
“–prefix=/usr/local/pcre” means that the installing software will be installed under /usr/local/pcre.

2.3 use the make command to compile the source file and generate the installation file:
$sudo make                                                      // compile

2.4 use command make install to install:
$ sudi make install                                              // install
If the installation succeeded, there would be four directories(bin/, include/, lib/, share/)generated under /usr/local/pcre, as following picture:

Selection_120

after installing the pcre, return to the httpd directory, and add the option –with-pcre=/usr/local/pcre behind ./configure.

It succeeded~~, and then perform make and make install.
Done!

Ubuntu搭建LAMP环境(安装最新的GD库文件)出现问题,没有头文件

继续安装php开发环境,当安装最新的GD库文件,执行make命令的时候,出现了没有头文件的问题。错误代码如下:

error: png.h: No such file or directory

其实就是头文件的路径不对。

解决办法:

vim gd_png.c

#include “png.h”             
替换成:
#include “/usr/local/libpng/include/png.h”  
           
然后再make就可以了

注:include“”双引号里包含的是libpng安装的路径里的include文件夹

Ubuntu搭建LAMP环境(安装libpng)出现问题,没有makefile文件

继续安装php开发环境,当安装到libpng的时候,输入make命令,确发现提示错误,没有找到makefile。

我还纳闷儿了,明明有makefile.am 和 makefile.in啊,configure以后不就生成makefile了嘛,于是又执行了一遍configure,结果在最后一行发现错误,如下。

configure: error: zlib not installed

google以后,发现大家都是用的这个方法解决:

1.进入zlib的源文件目录,执行命令 make clean,清除zlib;
2.重新配置 ./configure,后面不要接–prefix参数;
3.编辑 make && make install 安装;
4.进入libpng目录,执行命令 ./configure –prefix=/usr/local/libpng;
5.编译 make && make install 安装;

————————————-华丽丽的分割线,下面是英语版———————–

English Version:

Continue to install the PHP environment.
When install the libpng package after entering the make command, the error “cannot find the makefile” might occur.
I’m so confused~~,  the makefile.am and makefile.in obviously exsit in the directory. The makefile should be generated after configuring.
So I perform the configure command again, and then find this error:

configure: error: zlib not installed

Google it, find following solution that many people are using:
1. Enter the directory where the zlib source file is, and perform the make clean command to clean up zlib.
2. Reconfigure using  ./configure without  –prefix parameter.
3. Perform make and make isntall
4. Enter the libpng directory, execute the command ./configure –prefix=/usr/local/libpng.
5. Perform command make and make install.

Ubuntu搭建LAMP环境(安装libxml)出现问题

由于项目需要,得在自己的机器上搭建一套PHP开发环境。在安装libxml2-2.6.30,用make的时候出现以下问题。如下图所示。
Selection_107

In function ‘open’,inlined from ‘xmlNanoHTTPSave__internal_alias’ at nanohttp.c:1588:12:

/usr/include/i386-linux-gnu/bits/fcntl2.h:51:24:

error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments

解决办法:

打开libxml所在目录下的nanohttp.c,第1588行由
fd = open(filename, O_CREAT | O_WRONLY);更换为
fd = open(filename, O_CREAT | O_WRONLY,0777);
Selection_108

亲测,可行,重新make即可。

EasyPHP局域网内其他用户不能访问我的页面

做智能喵居的时候,需要用到PHP,一直都用的是EasyPHP开发。结果当我测试本机PHP与局域网内另一台机器通过socket通信的时候,发现另外一台机器怎么也访问不了我的PHP页面。

Google以后发现是配置问题,在 “你的EasyPHP目录/conf_files/httpd.conf” 文件的第62行(我的是EasyPHP 12.1,其他版本你搜索Listen关键字定位即可),你会发现他在这里指定监听端口号的时候,把IP地址也指定成了127.0.0.1,原话如下。

 

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:8887
Listen 127.0.0.1:8887

简单来说就是,你可以指定Apache访问的IP地址与端口,那么当你指定了IP为127.0.0.1以后,其他的IP就无法访问了,即使你使用本机的IP替代127.0.0.1。比如我的本机局域网IP是192.168.1.27。我可以通过127.0.0.1:8887访问EasyPHP,但是192.168.1.27:8887就访问不了。更别说局域网内其他机器了。

解决方法很简单:把127.0.0.1去掉,即把“Listen 127.0.0.1:8887” 换成“ 8887”即可。只指定端口号,不指定IP。

然后重启Apache,应该就可以了。如果还是不行,那就是你的防火墙神马的问题了。未命名

Windows下的PHP 5.3.x 配置 Zend Guard Loader

一直以来,我都用的EasyPHP(EasyPHP是一个Windows下的Apache+Mysql+Perl/PHP/Python开发包)来做php开发。这周由于项目需要,需要把一个经过Zend Guard加密的PHP项目解密。

由于Zend Optimizer只支持到php5.2.x,所以只好用Zend Guard Loader(支持php5.3.x)。配置了半天都不成功。google以后发现,是由于Zend Guard Loader不支持线程安全版本的php。

要查看自己的php是否支持线程安全,只需要在一个php文件里写上代码

<?php
phpinfo();
?>

然后运行就知道了。

我的运行结果如下图所示。是线程安全的,所以也不用配置了,没用。找其他方法吧。sigh~2

Keke

keke4_small

 

哈哈,正好是2013情人节那天,该我们家过年请客了,一大早就忙里忙外的准备。

吃完饭,可爱的小小弟Ⅰ号拿着手机到处拍照。既然拍到哥这里来,那就来个哥俩互拍吧(*^__^*) 嘻嘻……。