==================================
安装apach2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
apache2-bin apache2-data apache2-utils
Suggested packages:
apache2-doc apache2-suexec-pristine | apache2-suexec-custom
The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils
0 upgraded, 4 newly installed, 0 to remove and 281 not upgraded.
================================
启动apach2
root@build-All-Series:/etc/apache2# apache2
[Sat Aug 26 09:58:29.782417 2017] [core:warn] [pid 13026] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Sat Aug 26 09:58:29.782480 2017] [core:warn] [pid 13026] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Sat Aug 26 09:58:29.782508 2017] [core:warn] [pid 13026] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Sat Aug 26 09:58:29.782514 2017] [core:warn] [pid 13026] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Sat Aug 26 09:58:29.782533 2017] [core:warn] [pid 13026] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sat Aug 26 09:58:29.785144 2017] [core:warn] [pid 13026:tid 139638434740096] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sat Aug 26 09:58:29.785288 2017] [core:warn] [pid 13026:tid 139638434740096] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sat Aug 26 09:58:29.785301 2017] [core:warn] [pid 13026:tid 139638434740096] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}
root@build-All-Series:/etc/apache2# apachectl start
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
httpd (pid 12885) already running
==================================
卸载apache2
卸载命令apache
sudo apt-get remove apache
卸载关联
sudo apt-get autoremove
删除配置文件
root@build-All-Series:/etc/apache2# find /usr -name "*apache*"
/usr/sbin/apache2
/usr/share/man/man8/apache2.8.gz
/usr/share/bash-completion/completions/apache2ctl
/usr/share/vim/vim74/syntax/apachestyle.vim
/usr/share/vim/vim74/syntax/apache.vim
/usr/share/apport/package-hooks/apache2.py
/usr/share/lintian/overrides/apache2-bin
/usr/share/lintian/checks/apache2.desc
/usr/share/lintian/checks/apache2.pm
/usr/share/yelp-xsl/js/jquery.syntax.brush.apache.js
/usr/share/doc/apache2-bin
/usr/share/bug/apache2-bin
/usr/lib/apache2
root@build-All-Series:/etc/apache2# find /usr -name "*apache*" | xargs rm -rf
root@build-All-Series:/etc/apache2# find /var -name "*apache*"
/var/cache/apt/archives/apache2-utils_2.4.18-2ubuntu3.4_amd64.deb
/var/cache/apt/archives/apache2_2.4.18-2ubuntu3.4_amd64.deb
/var/cache/apt/archives/apache2-bin_2.4.18-2ubuntu3.4_amd64.deb
/var/cache/apt/archives/apache2-data_2.4.18-2ubuntu3.4_all.deb
/var/lib/dpkg/info/apache2-bin.list
/var/lib/dpkg/info/apache2-bin.md5sums
/var/lib/apache2
root@build-All-Series:/etc/apache2# find /var -name "*apache*" | xargs rm -rf
root@build-All-Series:/etc/apache2# find /etc -name "*apache*"
/etc/apparmor.d/abstractions/apache2-common
/etc/apache2
/etc/apache2/apache2.conf
root@build-All-Series:/etc/apache2# find /etc -name "*apache*" | xargs rm -rf
===================================
编译php 5.5.38
wget http://am1.php.net/distributions/php-5.5.38.tar.gz
tar zxvf php-5.5.38.tar.gz./configure
报错 error: xml2-config not found. Please check your libxml2 installation
解决 apt-get install libxml2-dev
make
make install
root@build-All-Series:/var/www/html/php-code/php-5.5.38# make install
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20121212/
Installing PHP CLI binary: /usr/local/bin/
Installing PHP CLI man page: /usr/local/php/man/man1/
Installing PHP CGI binary: /usr/local/bin/
Installing PHP CGI man page: /usr/local/php/man/man1/
Installing build environment: /usr/local/lib/php/build/
Installing header files: /usr/local/include/php/
Installing helper programs: /usr/local/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/lib/php/
[PEAR] Archive_Tar - installed: 1.4.0
[PEAR] Console_Getopt - installed: 1.4.1
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util - installed: 1.3.0
[PEAR] PEAR - installed: 1.10.1
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/lib/php to your php.ini include_path
/var/www/html/php-code/php-5.5.38/build/shtool install -c ext/phar/phar.phar /usr/local/bin
ln -s -f phar.phar /usr/local/bin/phar
Installing PDO headers: /usr/local/include/php/ext/pdo/
=====================================
第一次安装后发现没有php-fpm
./configure --enable-fpm
make
make install
=======================================
运行的时候报错
root@build-All-Series:/var/www/html/php-code/php-5.5.38# /usr/local/sbin/php-fpm
[28-Aug-2017 15:47:17] ERROR: failed to open configuration file '/usr/local/etc/php-fpm.conf': No such file or directory (2)
[28-Aug-2017 15:47:17] ERROR: failed to load configuration file '/usr/local/etc/php-fpm.conf'
[28-Aug-2017 15:47:17] ERROR: FPM initialization failed
解决
root@build-All-Series:/var/www/html/php-code/php-5.5.38/sapi/fpm# cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf
========================================
又报错 ERROR: [pool www] cannot get gid for group 'nobody'
解决方法 groupadd nobody
=======================================
启动php
/usr/local/sbin/php-fpm
========================================
php页空白,apache2 error.log 没有任何提示,可以看到php源码,应该是php没有解析
apt install libapache2-mod-php
apachectl -M | grep php
========================================
修改apache网站根目录
root@build-All-Series:/var/www/html# cat /etc/apache2/sites-enabled/000-default.conf | grep Document
DocumentRoot /var/www/
service apache2 restart
========================================
之前发现代码有问题,都是直接echo 一些东西来调试。怎么就没想到看apache2的日志呢!!!
root@build-All-Series:/var/www/html# tail -f /var/log/apache2/error.log
[Tue Aug 29 08:55:35.409593 2017] [php7:error] [pid 2066] [client 192.168.168.196:36969] PHP Fatal error: Uncaught Error: Call to undefined function xml_parser_create() in /var/www/html/request.php:908\nStack trace:\n#0 /var/www/html/request.php(584): xml2Array->parse('<?xml version="...')\n#1 /var/www/html/request.php(800): checkMD5file('/var/www/html/O...')\n#2 /var/www/html/request.php(263): createXML('O.7.0.10', NULL, '/var/www/html/O...', NULL)\n#3 {main}\n thrown in /var/www/html/request.php on line 908
报的是xml_parser_create 找不到这个函数,应该是一些库没安装吧
其实我也不确定是不是下面这个方法解决了上面的问题,但是我重启系统后发现突然可以了。这个问题搞了我几天,感觉以后不能太依赖apt下载软件,最好还是自己下源码编译,还有就是可以试着了解一些php的这些扩展。
./configure --enable-fpm --with-libexpat-dir 编译php的时候条件expat选项
configure: error: not found. Please reinstall the expat distribution.
wget https://launchpad.net/ubuntu/+archive/primary/+files/expat_2.0.1.orig.tar.gz
./configure
make
make install