phpvod setup record under CentOS 6.8 (compilation and installation of php52)

phpvod setup record under CentOS 6.8 (compilation and installation of php52)

newest You can see the original blog version , station c is rotten and not updated in time

Since the maintenance team of the project no longer maintains the project, this is only an archaeological project. At present, many Video CMS are better choices.

mysql httpd

yum install -y mysql
mysql -V
# mysql  Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1
# Start mysql
/etc/init.d/mysqld start
## Reference for the remaining steps https://blog.csdn.net/weixin_43031092/article/details/107125167
## https://blog.csdn.net/weixin_43031092/article/details/105456843
# Set the database root password
mysql_secure_installation

# Login database
mysql -u root -p
# Create a new account
grant all on *.* to username@localhost IDENTIFIED by 'password';

yum install -y httpd
httpd -v
# Server version: Apache/2.2.15 (Unix)
# Server built:   Jun 19 2018 15:45:13
# Start apache website service
service httpd start

php 5.2

Direct installation will be a relatively new version 7, and the modules required by the old program must be under 5.2, so you need to compile and install them yourself

  • ubuntu 18.04 -> php 7.4
  • centos 8.2 -> php 7.2
  • centos 6.8/6.5 -> php 5.3
# Install dependent packages
yum -y install gcc automake autoconf libtool gcc-c++ gd zlib zlib-devel openssl openssl-devel libxml2 libxml2-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel curl-devel httpd-devel bzip2-devel aspell-devel expat-devel libxslt-devel php-pdo php-pdo_mysql

# Download source code, version release list https://www.php.net/releases/
wget http://museum.php.net/php5/php-5.2.17.tar.gz
# Unzip the source code
tar -zxvf php-5.2.17.tar.gz && cd php-5.2.17
# configuration parameter
./configure --prefix=/usr/local/php52 --with-apxs2=/usr/sbin/apxs --with-config-file-path=/usr/local/lib/php52/  --disable-posix   --enable-bcmath   --enable-calendar   --enable-exif   --enable-fastcgi   --enable-ftp   --enable-gd-native-ttf   --enable-libxml   --enable-magic-quotes   --enable-mbstring   --enable-pdo   --enable-soap   --enable-sockets   --enable-wddx   --enable-zip  --with-bz2   --with-curl   --with-curlwrappers   --with-freetype-dir   --with-gd   --with-gettext   --with-jpeg-dir  --with-kerberos   --with-libexpat-dir   --with-libxml-dir  --with-libxml-dir   --with-mcrypt   --with-mhash   --with-mime-magic   --with-mysql  --with-mysqli   --with-openssl --with-openssl-dir --with-pcre-regex  --with-pdo-mysql   --with-pdo-sqlite   --with-pic   --with-png-dir   --with-pspell   --with-sqlite   --with-ttf   --with-xmlrpc   --with-xpm-dir=/usr/lib64/x11  --with-xsl --with-zlib   --with-zlib-dir

# Compile and install
make -j `nproc` && make install

# If the version check is normal, the following results will be displayed
/usr/local/php52/bin/php -v
## PHP 5.2.17 (cli) (built: Oct 22 2021 21:06:41) 
## Copyright (c) 1997-2010 The PHP Group
## Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

# Join PATH
nano ~/.bashrc
## Add the following to the end of the file
export PATH=/usr/local/php52/bin:$PATH

If the installation is successful, some important paths will be displayed, as shown below

Installing PHP CLI binary:        /usr/local/php52/bin/
Installing PHP CLI man page:      /usr/local/php52/man/man1/
Installing build environment:     /usr/local/php52/lib/php/build/
Installing header files:          /usr/local/php52/include/php/
Installing helper programs:       /usr/local/php52/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php52/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php52/lib/php/

Error resolution

  1. Configuration error apxs
Sorry, I cannot run apxs.  Possible reasons follow:

1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)

The output of /usr/sbin/apxs follows:
./configure: line 6461: /usr/sbin/apxs: No such file or directory
configure: error: Aborting

reference resources PHP compilation error} Sorry, I cannot run apxs. Possible reasons follow. Technology expert 2017-11-12

yum install -y httpd-devel

  1. Configuration error BZip2
checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution

reference resources Error in compiling and installing PHP 7.2: checking for BZip2 in default path... not found configure: error: Please reinstall. PrinciplesMan 2021-07-16 10:01:35 120 , bzip has been installed, but the dev version is missing

yum install bzip2-devel -y

  1. Compile error: configure: error: libjpeg.(a|so) not found

reference resources this

cp -frp /usr/lib64/libjpeg.* /usr/lib

  1. Compile error: configure: error: libpng.(a|so) not found

cp -frp /usr/lib64/libpng* /usr/lib/

  1. Configuration error BZip2

The test is invalid after trying to install libxpm devel; The parameter specified -- with XPM dir = / usr / lib test is invalid; reference resources this

ln -s /usr/lib64/libXpm.so* /usr/lib/
And specify at compile time, -- with XPM dir = / usr / lib64 / X11

# The above scheme is actually quite strange, because this path does not exist, but it does solve this problem
[root@VM-0-4-centos php-5.2.17]# cd /usr/lib64/x11
-bash: cd: /usr/lib64/x11: No such file or directory
[root@VM-0-4-centos php-5.2.17]# cd /usr/lib64/X11
[root@VM-0-4-centos X11]# 

# View phase file
cd /usr/lib
find ./ libXpm*
# libXpm.so.4
# libXpm.so.4.11.0

cd /usr/lib64
find ./ libXpm*
# libXpm.so
# libXpm.so.4
# libXpm.so.4.11.0
  1. checking for U8T_DECOMPOSE...
    configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

reference resources configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. 2013

yum install -y libc-client-devel

So a new error is reported. Configure: error: cannot find IMAP Library (libc client. A). Please check your c-client installation. Simply delete -- with IMAP -- with IMAP SSL in the configuration parameters

  1. configure: error: Please reinstall libmhash - I cannot find mhash.h

reference resources configure: error: Please reinstall libmhash – I cannot find mhash.h. 2013

sudo yum install -y libmhash-devel

  1. configure: error: Cannot find MySQL header files under yes.
checking whether to include mime_magic support... yes
checking for MING support... no
checking for mSQL support... no
checking for MSSQL support via FreeTDS... no
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore!

Solution to prompt "Cannot find MySQL header files" when compiling php. vast2006. 2011-03-21

yum install -y mysql-devel

  1. Error: configure: error: Cannot find libmysqlclient under /usr
    Note that the MySQL client library is not bundled anymore!

reference resources Error in compiling and installing php service: configure: error: Cannot find libmysqlclient under /usr. 19/08/17 , there is no libmysqlclient in / usr/lib, and many are found in / usr/lib64 with find. / * MySQL *

ln -s /usr/lib64/mysql/libmysqlclient.so /usr/lib/libmysqlclient.so

  1. configure: error: Cannot find pspell

Cannot find pspell – Fix PHP Configuration Error

yum install -y aspell-devel

  1. configure: error: not found. Please reinstall the expat distribution

yum install -y expat-devel
ln -s /usr/lib64/libexpat.so /usr/lib/libexpat.so

  1. configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

yum install -y libxslt-devel

  1. apache httpd does not correctly parse php files, but simply returns php source code. Please refer to What if linux apache doesn't parse php. 2020-08-10
// info.php
<?php phpinfo(); ?>
# Find the configuration file for httpd
find / -name "httpd.conf"
## /etc/httpd/conf/httpd.conf

# Edit profile
nano /etc/httpd/conf/httpd.conf
## Paste into the following content
AddType application/x-httpd-php .php

## Find directoryindex.html index.html.var and append index.php to it, as shown below
DirectoryIndex index.html index.html.var index.php

Zend Optimizer 3.3.9

Please note that Zend Optimizer is only available for the accounts using PHP version 5.2 or below.

wget http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
tar -xzvf ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
cp ZendOptimizer-3.3.9-linux-glibc23-x86_64/data/5_2_x_comp/ZendOptimizer.so /usr/local/php52/lib/ZendOptimizer.so

nano /usr/local/lib/php52/php.ini
# Paste into the following content, and the path of the third line depends on the result copied above
Zend Optimizer options 
zend_optimizer.optimization_level=1023
zend_extension=/usr/local/php52/lib/ZendOptimizer.so

phpvod

unrar

Because the compressed format of the source code uploaded to the server is rar, tar does not support compressed files in this format. Here, compile and install a RAR to solve this problem. Of course, you can also repackage the format to the server.

# Download source code, reference https://www.jianshu.com/p/5a5f17e4a911
wget http://www.rarlab.com/rar/rarlinux-x64-5.3.0.tar.gz --no-check-certificate
# decompression
tar -zxvf rarlinux-x64-5.3.0.tar.gz
cd rar
# Install rar
make

install

# Unzip the source code
unrar x phpvod2_utf-8.rar
# Copy the source code to the default website root directory
cp -r ./phpvod/* /var/www/html/
# Directory permission modification
chmod 777 /var/www/html -R

If zend is not configured correctly, it will be displayed on the homepage (index.php) that Zend Optimizer is not installed. After the correct configuration, the homepage is blank and enter the installation page (install.php)

Problem solving

  1. There is an error in install.htm on the installation page - your PHP environment does not have a short flag enabled, and the installation cannot continue., And the text of the license agreement is displayed as $land_licence; This error does not appear in install.php, and the license agreement is completely displayed as the agreement text.

reference resources php: "short_open_tag = On" not working. 2012 , it should be noted that if there is no such error in install.php, it can be ignored, because it is installed through install.php instead of install.htm. Whether the short tag is enabled can be queried from the phpinfo page.

# Edit custom profile
nano /usr/local/lib/php52/php.ini
# Find the corresponding content and add content later
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

AddType text/html .shtml .html .htm
AddOutputFilter INCLUDES .shtml .html .htm
  1. Website root... 777 attribute detection failed

chmod 777 /var/www/html -R

Effect preview


Tags: PHP Apache CentOS

Posted on Tue, 02 Nov 2021 16:09:22 -0400 by itisme