linux下php、apache、mysql、curl环境搭建

安装apache,php的目录:/home/zhangweikuang.pt
1.下载apache
phpmysqlcurl扩展安装包
curl-7.21.0.tar.gz httpd-2.2.15.tar.gz php-5.2.11.tar.gz mysql-5.0.24.tar.gz

 
2.
先安装apache

1tar zvxf httpd-2.2.15.tar.gz

2cd httpd-2.2.15

3./configure --prefix=/home/zhangweikuang.pt/apache --enable-mods-shared=all --enable-cache --enable-disk-cache --enable-mem-cache --enable-so

4make && make install

apache安装完成

 
#####
我自己没有装mysql,安装过程也列在下面

3.安装mysql

atar -xzf mysql-5.0.24.tar.gz

bcd mysql-5.0.24

c./configure --prefix=/home/zhangweikuang.pt/mysql --sysconfdir=/etc --localstatedir=/var/lib/mysql --with-charset=gbk --with-extra-charset=utf8,gbk,gb2312,all

dmake install

e/home/zhangweikuang.pt/mysql/bin/mysql_install_db

fsudo chown -R admin:admin /home/zhangweikuang.pt/mysql/var

g/home/zhangweikuang.pt/mysql/bin/mysqld_safe &

hmysql -h localhost -u root -pno password)登录后show databases;可以看到有mysql数据库

i/home/zhangweikuang.pt/mysql/bin/mysqladmin -u root password 'yourpassword'修改密码

 

4.安装curl模块

1tar zvxf curl-7.21.0.tar.gz

2cd curl-7.21.0

3./configure --prefix=/home/zhangweikuang.pt/curl

4make && make install

curl安装完成

 

5.安装php

1tar zvxf php-5.2.11.tar.gz

2cd php-5.2.11

3./configure --prefix=/home/zhangweikuang.pt/php --with-apxs2=/home/zhangweikuang.pt/apache/bin/apxs --with-curl=/home/zhangweikuang.pt/curl/ --enable-mbstring--with-mysql=/home/zhangweikuang.pt/mysql

4make && make install

5cpphp.ini-development/home/zhangweikuang.pt/php/lib/php.ini

6php.ini中找到;date.timezone = 去掉前面分号改为date.timezone = Asia/Chongqing

php安装完成

 

6.配置apacheconfig文件/home/lanshang/apache/conf/httpd.config

1修改监听端口Listen8713

2<IfModule> </IfModule>中增加一行让apache把后缀为.phpphtml的文件交给php来解析

AddType application/x-httpd-php .php .phtml

3)新建测试文件/home/apache/htdocs/index.php

<?php

echo "hello";

phpinfo();

?>

4启动apache服务/home/zhangweikuang.pt/apache/bin/apachectl -k start

5检查apche的错误日志是否有错误出现tail -f /home/zhangweikuang.pt/apache/logs/error_log

6浏览器打开http://10.232.41.124:8713/index.php

hello查看curl模块

 
一种情况是php未安装的前提下在安装php的时候只要加上–with-curl=/usr/local/curl就可以;

 另一种情况是php已经安装,在现有的基础的上扩展curl模块。

大多数情况我们会遇到第二种情况,这里我记录了一下自己在已安装的php基础上扩展curl模块,这里有个前提条件就是curl需要提前安装好。

安装扩展步骤:

1.安装curl

1tar zvxf curl-7.17.1.tar.gz

2cd curl-7.17.1

3./configure --prefix=/home/lanshang/curl

4make && make install

2.php的源码路径

1cd /home/lanshang/php-5.3.2/ext/curl

2/usr/local/php/bin/phpize

3./configure --with-curl=/home/zhangweikuang.pt/curl或者./configure --with-curl=/home/zhangweikuang.pt/curl --with-php-config=/home/zhangweikuang.pt/php/bin/php-config

4make

5cp modules/curl.so  /home/lanshang/php/lib/php/extensions/

6修改php.ini文件,加入: extension=curl.so

7)查看phpinfo(),是否有curl模块

多谢岚裳,此文档乃岚裳整理。

你可能感兴趣的:(linux,mysql,数据库,休闲,linux.测试环境搭建)