Configure PHP to start Apache service error

Source: Internet
Author: User

After the new server (CentOS 6.3) compiles and installs the php-5.4.8, and then configures the php.ini and httpd.conf, the command executes/USR/LOCAL/APACHE2/BIN/APACHECTL when the apache-2.4.3 is started When start, Tip:

httpd:syntax error on line 146 Of/etc/httpd/conf/httpd.conf:cannot load/usr/local/apache/modules/libphp5.so int O Server:/usr/local/apache/modules/libphp5.so:undefined symbol:zend_parse_parameters

Found by search, said to be missing bison.

If you find that Bison is not installed by Rpm-qa|grep Bison, install bison. CentOS can be used with Yum install Bison

But I have found that bison-2.4.1 has been installed. Finally, there is no way to download the bison-2.5 RPM package to install directly.

[[email protected]~]# wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz [[email protected]~]# TAR-ZXVF bison-2.5.tar.gz [[email protected]~]# CD bison-2.5 [[email protected]~]#./configure [[email protected]~]# make && make install

And then recompile the PHP installation. Then/usr/local/apache2/bin/apachectl start to launch Apache. The surprise discovery can start normally, test the next PHP Web page, can be accessed normally.

I heard that others will report the following error, I also write it together.

When the command executes/USR/LOCAL/APACHE2/BIN/APACHECTL start, the error message is as follows:

Httpd:syntax error on line 146 Of/usr/local/apache/conf/httpd.conf:cannot load/usr/local/apache/modules/libphp5.so in To server:/usr/local/apache/modules/libphp5.so:cannot Restore segment prot after Reloc:permission denied

This is caused by the SELinux protection mode. There are 2 ways to solve this problem.

First: Permanently turn off SELinux protection mode (not recommended, risk to the server)

[~]#  

Change Selinux=enforcing to Selinux=disabled

Save the reboot system.

Second method: Temporarily turn off SELinux mode
[~]#   setenforce 0[~]#  Chcon-c- V-r-u system_u-r object_r-t textrel_shlib_t/usr/local/apache/modules/libphp5.so

If the above command is an error, you can try this chcon-t texrel_shlib_t/usr/local/apache/modules/libphp5.so

If there are any errors, please use the Help to write the commands according to the help.

[~]#  service httpd restart[~]#  Setenforce 1

Configure PHP to start Apache service error

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.