linux 安装配置lamp v2

2019-10-15 21:53:21王旭

找到DirectoryIndex index.html
改为 DirectoryIndex index.html index.htm index.php,这是在给apache设置默认首页。并且是有先后顺序的。

修改www的目录

先mkdir /var/www

然后修改httpd.conf里

DocumentRoot "/var/www"

<Directory "/var/www">
# cp /usr/lamp/apache2/bin/apachectl /etc/init.d/httpd
设置开机自启动
# chkconfig --add httpd

这里会出现错误.在httpd里的第一行下面加上:

# myz

# chkconfig: 2345 60 40

# description: MyZ Server
将apache添加为系统服务
# service httpd start

这里先等一等,因为libphp5.so要装完php才会有。

关于Permission denied的错误

处理如下:

1. vi /etc/sysconfig/selinux

更改SELINUX=disabled

2.chcon -t texrel_shlib_t /usr/apache/modules/libphp5.so

或者简单的方法去关掉selinux,#setup在里面找selinux相关的disabled掉。
然后start就会开启服务了,同理service httpd stop就是停止服务。还可以service httpd restart。不过这个没有什么提示信息,你可以自己编写个shell脚本,加入一些提示信息就显得好看多了。

这里启动会出现一点错误:

httpd could not reliably determine

需要在httpd.conf 中的ServerName:www.example.com:80下面加上

www.yourdomain.com:80

对了如果ping不通80端口试试关掉linux的防火墙试试,#setup里面有。

 

php

# ./configure --prefix=/usr/myz/php

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

--with-config-file-path=/etc

--enable-safe-mode

--with-zlib=

--with-zlib-dir=/usr/local/lib

--with-libxml-dir=/usr/local/lib

--enable-mbstring

--with-mysql=/usr/myz/mysql

--with-mysql-sock=/tmp

--with-pdo-mysql=/usr/myz/mysql

--enable-soap

--with-xmlrpc

--enable-sockets

--with-curl=/usr/local/lib

--with-xsl=/usr/local/lib

--with-openssl=/usr

--with-gd=/usr/local/lib

--with-jpeg-dir=/usr/local/lib

--with-png-dir=/usr/local/lib

--with-freetype-dir=/usr/loca/lib

 

蓝字的是我觉得必须的.

有的是需要装的.比如apache,zlib,libxml2,libcurl,libxslt

我用的是5.2.5有的东西是默认的enable 比如cli

这个不全...但是够用...但是不好...但是也太多了

我编了N遍!!!!

美中不足.没有装上libcURL还有xslt

make

最可怕的是在make test时不断循环...最后退不出去.只能reset电脑...

make install

又出现错误,说找不到libphp5.so,搜了半天,最后把所有的删掉重来一次.OK

复制php.ini-recommended为php.ini,并存放到/etc/目录下.

 

php配置

这个...随意吧...因为是实验所以什么也没改...只看了下phpinfo()

 

结束...