LAMP环境安装
软件准备:
Linux 7.3.1611
mariadb-10.1.22
php-5.6.33
1、yum 安装httpd
安装报错需求:httpd-tools-2.4.6-67.el7.contos.x86.rpm
安装httpd-tools需求:apr-1.4.8-3、apr-util-1.5.2
rpm -ivh apr-1.4.8-3.el7.x86_64.rpm
rpm -ivh apr-util-1.5.2-6.el7.x86_64.rpm
rpm -ivh httpd-tools-2.4.6-67.el7.centos.x86_64.rpm
yum instlal httpd httpd-devel
2、安装mysql
useradd mysql -s /sbin/nologin -M mkdir /data chown -R mysql.mysql /data tar -zxvf mariadb-10.1.22-linux-x86_64.tar.gz /usr/local/ cd /usr/local ln -s mariadb-10.1.22-linux-x86_64 ./mysql chown -R mysql.mysql mysql/ mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data cp my-huge.cnf /etc/my.cnf cp mysql.server /etc/init.d/mydqld vim /etc/my.cnf [mysqld] basedir=/usr/local/mysql datadir=/data port = 3306 socket = /tmp/mysql.sock [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid touch /var/log/mysqld.log chown mysql.mysql /var/log/mysqld.log mkdir /var/run/mysqld chown -R mysql.mysql /var/run/mysqld services mysqld start
3、安装php
安装依赖包
yum install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng \ lib-png-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel \ ncurses curl openssl-devel db4-devel libXpm-devel libX11-devel gmp-devel readline-devel libxslt-devel \ expat-devel xmlrpc-c libcurl libcurl-devel tar zxvf libmcrypt-2.5.8.tar.gz ./configure make & make install
编译安装php
tar -zxvf php-5.6.33.tar.gz cd php-5.6.33 ./configure --prefix=/usr/local/php --with-config-file-path=/etc --with-apxs2=/usr/bin/apxs \ --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-inline-optimization \ --enable-fpm --enable-soap --with-libxml-dir --with-xmlrpc --with-openssl --with-mcrypt --with-mhash \ --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar \ --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir \ --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir \ --enable-gd-native-ttf --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring \ --disable-mbregex --disable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-pdo-mysql \ --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml \ --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir \ --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear make & make install
配置PHP
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm /usr/local/php/sbin/php-fpm -t services php-fpm start
配置apache访问php
vim /usr/local/apache/conf/httpd.conf AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps DirectoryIndex index.php index.html LoadModule php5_module /usr/lib64/httpd/modules/libphp5.so 测试页面: vi /var/www/html/test.php <?php phpinfo(); ?>

浙公网安备 33010602011771号