ZendOptimizer.so: cannot restore segment prot after reloc: Permission denied


On a server after ZendOptimizer installation, Zend is not working, php -v shows following error.

# php -v
Failed loading /usr/local/Zend/lib/Optimizer-3.3.0/php-5.1.x/ZendOptimizer.so:  /usr/local/Zend/lib/Optimizer-3.3.0/php-5.1.x/ZendOptimizer.so: cannot restore segment prot after reloc: Permission denied
PHP 5.1.6 (cli) (built: Dec 19 2006 11:18:44)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
    with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies

This is because SELinux is enabled on the server.

Run:
# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 21
Policy from config file:        targeted

You need to disable selinux, Disable SELinux by running command 

# setenforce 0
This will only work until you reboot the server. For permanent solution edit /etc/selinux/config
# vi /etc/selinux/config

You need to set SELINUX=disabled on the file. Do a reboot after editing the file.
[root@localhost html]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

This will resolve the issue.

Thank you.

Leave a comment