Compile and install php-5.6.3.tar.gz under CentOS6.5

1. Install related dependencies
    yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel curl curl curl-devel openssl openssl- devel openldap openldap-devel nss_ldap openldap-clients openldap-servers pcre pcre-devel
2. Unzip the php package
tar -zxvf php-5.6.3.tar.gz
cd php-5.6.3
export LD_LIBRARY_PATH=/usr/local/libgd/lib
3. Compile and install
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc/ --with-mysql=/usr/local/mysql --with-mysql- sock=/usr/local/mysql/mysql.sock --with-apxs2=/usr/local/apache/bin/apxs --with-gd --with-jpeg-dir --with-png-dir --enable -mbstring --enable-xml --enable-fpm --with-freetype-dir --with-mcrypt --with-mhash --with-libxml-dir --with-zlib-dir
make
make install
Fourth, configure php
cp php.ini-production /usr/local/php/etc/php.ini #Copy the php configuration file to the installation directory
===>
When I installed it, it didn't work here, move it to /usr/local/php Under /lib, normal

rm -rf /etc/php.ini #Delete the system's own configuration file
ln -s /usr/local/php/etc/php.ini /etc/php.ini #Add a soft link to the /etc directory
vi /etc/php.ini
found: disable_functions=
Modified to: disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen , disk_free_space, checkdnsrr, checkdnsrr, getservbyname , getservbyport, disk_total_space, posix_ctermid, posix_get_last_error, posix_getcwd, posix_getegid, posix_geteuid, posix_getgid, posix_getgrgid, posix_getgrnam, posix_getgroups, posix_getlogin, posix_getpgid, posix_getpgrp, posix_getpid, posix_getppid, posix_getpwnam, posix_getpwuid, posix_getrlimit, posix_getsid, posix_getuid ,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname #List
the functions that PHP can disable, if some programs need to use this function, you can delete, cancel the disable .
Find: ; date.timezone = change to: date.timezone
= PRC #Set time zone
Find : expose_php = On
Change to: expose_php = Off #Suppress the display of php version information
Find : short_open_tag = Off
Change to: short_open_tag = ON #Support php Short label
: wq! Save


cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf #Copy the template file as the php-fpm configuration file
ln -s /usr/local/php/etc/php-fpm.conf /etc/php-fpm.conf #Add soft link to /etc directory
vi /usr/local/php/etc/php-fpm.conf #Edit
user = www #Set the php-fpm running account to www
group = www #Set the php-fpm running group to www
pid = run/php-fpm.pid #Cancel the previous semicolon
: wq! #Save and exit

cp /home/php-5.6. 3/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm #Copy php-fpm to the startup directory
chmod +x /etc/rc.d/init.d/php -fpm #Add execute permission
chkconfig php-fpm on #Set boot up
Edit apache configuration file httpd.conf to support php with apache
# vim /etc/httpd/httpd.conf
add the following

AddType application/x-httpd-php .php .phtml
locate to DirectoryIndex index. html

is modified to:
DirectoryIndex index.php index.html
Add index.php as the default home
page Restart apache
5. Test Create a test.php or test.phtml file
in the /usr/local/apache/htdocs directory, the content is as follows :
<</FONT>
?
php
phpinfo();
?
>
:wq! #Save and exit

=============================== ===========================

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-pear --with-curl --with-openssl

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326855113&siteId=291194637