配置ZendDebugger小计


丫PHP5.3.20 从 zend家网站上下载好的ZendDebugger.so死活不能用,在phpinfo上没显示。

看日志:

Failed loading /usr/lib/php/modules/ZendDebuggerx.so:  /usr/lib/php/modules/ZendDebuggerx.so: cannot open shared object file: No such
file or directory

它原来是缺少一个倚赖的类库,装上,齐活儿!

参考:http://live.dynet.com:8008/install-zend-debugger-in-redhatcentos/

我把人家的东西还是贴过来把,万一什么时候没了,就坏了。

Install Zend Debugger in RedHat/CentOS
Posted on March 21, 2012 by wpadmin

In order to setup a PHP development server with debugging capabilities, ZendDebugger must be installed on your web server.
First download Studio Web Debugger from here and install it on your web server following the instructions in the README.txt file.

Verify it is properly installed by issuing:

php -v

You should get back:

PHP 5.3.3 (cli) (built: Jan 21 2011 09:44:01)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Zend Debugger v5.3, Copyright (c) 1999-2010, by Zend Technologies

If you get an error like this:

Failed loading /usr/lib/php/modules/ZendDebugger.so:  libssl.so.0.9.8: cannot open shared object file: No such file or directory
PHP 5.3.3 (cli) (built: Jan 21 2011 09:44:01)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

then you need the libssl.so.0.9.8 library. The version shipped with the OS is 1.0.0 so you could create a symbolic like this (as root):

# ln -s /usr/lib/libssl.so.1.0.0 /usr/lib/libssl.so.0.9.8

Alternatively, if you are running your OS in a VM then there’s already a 0.9.8 library on the vmware tools directory. Just create your symbolic link like this:

# ln -s /usr/lib/vmware-tools/lib32/libssl.so.0.9.8/libssl.so.0.9.8 /usr/lib/libssl.so.0.9.8

Now, if you issue php -v again, it will fail in the same way but  now for the libcrypto.so.0.9.8 library. Proceed exactly as you did for the libssl.so.0.9.8 and now you should get the correct result.

But the problems are not over yet. Restart your web server and try to debug it (most likely using Zend Studio). You can’t. Check your web server’s log file:

# tail /var/log/httpd/error_log

...

Failed loading /usr/lib/php/modules/ZendDebugger.so:  /usr/lib/php/modules/ZendDebugger.so: cannot enable executable stack as shared object requires: Permission denied

This message is caused by SELinux. You will also see another log entry in /var/log/audit/audit.log that accompanies this error. The reason is that SELinux prevents web server modules from doing execmem/execstack and ZendDebugger does this. You need to tell SELinux to allow this:

# setsebool -P httpd_execmem on

Restart your web server and try to debug again. Now you get a different error:

# tail /var/log/httpd/error_log
...
Failed loading /usr/lib/php/modules/ZendDebugger.so:  /usr/lib/php/modules/ZendDebugger.so: cannot restore segment prot after reloc: Permission denied

You get this error now because ZendDebugger is not properly labelled. Issue the following command:

chcon -t textrel_shlib_t /usr/lib/php/modules/ZendDebugger.so

After you restart your web server you should be able to debug. If you never had the need for your web server to communicate with other services then you might still get one last error:

# tail /var/log/audit/audit.log
...
type=AVC msg=audit(1332126086.741:120): avc:  denied  { name_connect } for  pid=2301 comm="httpd" dest=10137 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:port_t:s0 tclass=tcp_socket

You need to tell SELinux to enable the web server to communicate with other services:

# setsebool -P httpd_can_network_connect on

So now you can debug your web server to your heart’s content and best of all you didn’t need to turn off SELinux.


你可能感兴趣的:(Linux,PHP)