Install php5.5 in Linux

Source: Internet
Author: User

After downloading the installation package, you must install libxml2 before installing PHP. Therefore, you can download the libxml2 installation package and compile and install it.

I'm using the Yum-y install libxml2 libxml2-devel (if this is not installed, I will find a parsing error)

Configuration :. /configure -- prefix =/usr/local/PHP -- with-apxs2 =/usr/local/Apache/bin/apxs -- With-mysql =/usr/local/MySQL -- With-config- file-Path =/usr/local/PHP -- enable-mbstring = all

This is the simplest or most basic requirement (the first three)

Make

Make install. If the following prompt is displayed, PHP installation is successful.

  1. Installing php sapi module: apache2handler
  2. /Usr/local/apache2/build/instdso. Sh sh_libtool = '/usr/lib/apr-1/build/libtool 'libphp5.la/usr/local/apache2/modules
  3. /Usr/lib/apr-1/build/libtool -- mode = install CP libphp5.la/usr/local/apache2/modules/
  4. Libtool: Install: CP. libs/libphp5.so/usr/local/apache2/modules/libphp5.so
  5. Libtool: Install: CP. libs/libphp5.lai/usr/local/apache2/modules/libphp5.la
  6. Libtool: Install: Warning: Remember to run 'libtool -- Finish/home/go_yueyue/downloads/php-5.3.6/libs'
  7. Chmod 755/usr/local/apache2/modules/libphp5.so
  8. [Activating module 'php5 'in/usr/local/apache2/CONF/httpd. conf]
  9. Installing php cli binary:/usr/local/bin/
  10. Installing php cli man page:/usr/local/man/Man1/
  11. Installing Build Environment:/usr/local/lib/PHP/build/
  12. Installing header files:/usr/local/include/PHP/
  13. Installing helper programs:/usr/local/bin/
  14. Program: phpize
  15. Program: PHP-config
  16. Installing man pages:/usr/local/man/Man1/
  17. Page: phpize.1
  18. Page: php-config.1
  19. Installing pear environment:/usr/local/lib/PHP/
  20. [Pear] archive_tar-installed: 1.3.7
  21. [Pear] lele_getopt-installed: 1.3.0
  22. [Pear] structures_graph-installed: 1.0.4
  23. [Pear] xml_util-installed: 1.2.1
  24. [Pear] pear-installed: 1.9.2
  25. Wrote pear system config file at:/usr/local/etc/pear. conf
  26. You may want to add:/usr/local/lib/PHP to your php. ini include_path
  27. /Home/gogo_yueyue/download/php-5.3.6/build/shtool install-c ext/phar. phar/usr/local/bin
  28. Ln-S-F/usr/local/bin/phar. phar/usr/local/bin/phar
  29. Installing PDO headers:/usr/local/include/PHP/EXT/PdO/

Therefore, we need to modify the Apache configuration file to support PHP parsing.

Addtype application/X-httpd-PHP. php. php3

Indicates that PHP files can be parsed in Apache.
Next, check the PHP dynamic connection library file generated under the Apache directory and find whether the libphp5.so file exists in the directory/usr/local/Apache/modules.

/Usr/local/Apache/bin/apachectl-M view all supported modules and check whether php5.so is supported

Create a PHP file under/usr/local/Apache/htdocs/and restart Apache to test

Problems:

When you restart Apache, the following error occurs: httpd:
Syntax Error on line 53 of/usr/local/Apache/CONF/httpd. conf: cannot load/usr/local/Apache/modules/libphp5.so into server:/usr/local/Apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied

Cause: There is a SELinux protection mode in Linux.
  
Solution:
  
1. Method for disabling SELinux:
VI/etc/SELinux/config change SELinux = enforcing to SELinux = disabled and restart
This method may cause risks to the server.
2. Do not disable SELinux:
# Setenforce 0
# Chcon-C-v-r-u system_u-r object_r-T textrel_shlib_t/usr/local/Apache/modules/libphp5.so
  
# Service httpd restart
# Setenforce 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.