centos下lamp环境搭建
centos

全程yum安装了,不源代码安装了,太折腾了。
1.安装并启动apache
1 2 3 | yum install httpd httpd-devel // 安装 /etc/init .d /httpd start // 启动 |
此时输入服务器 ip,就可以看到apache的info页面了
2.安装并启动mysql
1 2 3 | yum install mysql mysql-server // 安装 /etc/init .d /mysqld start // 启动 |
3.安装php
1 | yum install php php-devel |
在/var/www/html中建立,index.php文件,重启apache
1 | <?php phpinfo(); |
1 | /etc/init .d /httpd restart |
输入服务器ip,查看php版本为5.3.3,太低了,稍候升级一下。
安装php拓展
1 | yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc |
升级php
下最新包,我用的是5.6.1
解压
通过
1 | php -i | grep configure |
查看配置信息
1 2 3 | . /configure --prefix= /alidata/server/php --with-config- file -path= /alidata/server/php/etc --with-apxs2= /alidata/server/httpd/bin/apxs --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd -- enable -static -- enable -maintainer-zts -- enable -zend-multibyte -- enable -inline-optimization -- enable -sockets -- enable -wddx -- enable -zip -- enable -calendar -- enable -bcmath -- enable -soap --with-zlib --with-iconv --with-gd --with-xmlrpc -- enable -mbstring --without-sqlite --with-curl -- enable - ftp --with-mcrypt --with-freetype- dir = /usr/local/freetype .2.1.10 --with-jpeg- dir = /usr/local/jpeg .6 --with-png- dir = /usr/local/libpng .1.2.50 --disable-ipv6 --disable-debug --with-openssl --disable-safe-mode --disable-fileinfo make clean make && make install |
一堆错误,高版本依赖了几个包,依次执行
1 2 3 4 5 6 | yum install libxml2-devel -y yum install openssl openssl-devel ln -s /usr/lib64/libssl .so /usr/lib/ yum install libxml2-devel yum install bzip2 -devel yum install gmp-devel |
安装 成功