Показаны сообщения с ярлыком Apache. Показать все сообщения
Показаны сообщения с ярлыком Apache. Показать все сообщения

вторник, 29 мая 2012 г.

пятница, 18 мая 2012 г.

Enable Apache mod_status in Gentoo

Params:
OS: Linux solar 3.1.6-gentoo #16 SMP Thu Jan 5 14:49:10 GMT 2012 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ AuthenticAMD GNU/Linux
Apache-2.2

Problem:
I need enable apache module mod_status.


Solution:
Edit apache conf file: "/etc/conf.d/apache2"
Add option "-D STATUS" to the directive "APACHE2_OPTS"
Example string:
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5 -D STATUS"

Restart apache and follow here "http://localhost/server-status"

понедельник, 9 января 2012 г.

Configure Zend Debugger

Params:
Linux Gentoo 3.1.6
PHP 5.3.8-pl0-gentoo
Apache 2.2.21-r1

Problem:
Need to configure Zend Debugger.

Solution:
1) Download Zend Debugger from site zend.com
2) Unpack archive to the temporary folder.
3) Find ZendDebugger.so file with version compatibale to your PHP version
For example, I have PHP version 5.3.8 so my ZendDebugger.so file located in 5.3.x folder.
4) Copy ZendDebugger.so to the folder accesibale by apache.
For example: /home/<user_name>/Applications/ZendDebugger/ZendDebugger.so
5) Edit php.ini. Location of php.ini depends by system. For Gentoo is here: /etc/php/apache2-php5.3/php.ini
6) Add following lines to the end of php.ini:

[Zend]
zend_extension=/home/<user_name>/Applications/ZendDebugger/ZendDebugger.so
zend_debugger.allow_hosts=127.0.0.1
zend_debugger.expose_remotely=always
About this and additional options you can read in internet.
7) Restart the apache. In gentoo just execute /etc/init.d/apache2 restart
8) Check debugger. Look to the phpinfo() if all "ok!" you will see section "Zend Debugger" with config options.
9) Fix errors. If you can't see "Zend Debugger" section look to the apache error log file and fix the errors.
Log file in Gentoo: /var/log/apache2/error_log
In my case I have this errors:
* Failed loading /home/<user_name>/Applications/ZendDebugger/ZendDebugger.so:  libssl.so.0.9.8: cannot open shared object file: No such file or directory
* Failed loading /home/<user_name>/Applications/ZendDebugger/ZendDebugger.so:  libcrypto.so.0.9.8: cannot open shared object file: No such file or directory
So I create soft links to the existing libs "libssl.so.1.0.0" and "libcrypto.so.1.0.0"
> ln -s /usr/lib/libssl.so.1.0.0 /home/<user_name>/Applications/ZendDebugger/
> ln -s /usr/lib/libcrypto.so.1.0.0 /home/<user_name>/Applications/ZendDebugger/
links must be in the same folder with ZendDebugger.so

That's all.

суббота, 7 января 2012 г.

Configure Apache to interpret PHP scripts

Params:
- Linux solar 3.1.6-gentoo #16 SMP Thu Jan 5 14:49:10 GMT 2012 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ AuthenticAMD GNU/Linux,
- PHP 5.3.8-pl0-gentoo,
- Apache/2.2.21 (Unix)

Problem:
Apache not interpret php scripts, theirs content printed in browser.

Solution:
Edit apache config file /etc/conf.d/apache2 (don't forget this is gentoo!)
Find string where defined parameter APACHE2_OPTS and add "-D PHP5" to his value.

воскресенье, 25 декабря 2011 г.

PHP sessions across sub domains

Params:
PHP-5.3, Apache-2.2

Problem:
I need a single session for mysite.com and admin.mysite.com domains. I would login on main domain mysite.com, and will be already authorized on sub domains like admin.mysite.com.


Solution:
In script before session start need too setup this session parameters:
session.cookie_path = "/"
session.cookie_domain = ".mysite.com" - dot at the beginning is important, it specify use same sessions on sub domains

Example:
Example for Zend Framework application.


Define site domain name value:
*** public/index.php ***
...
defined('SITE_DOMAIN_NAME')
|| define('SITE_DOMAIN_NAME', (getenv('SITE_DOMAIN_NAME') ? getenv('SITE_DOMAIN_NAME') : 'mysite.com'));
...
It seems, if server value SITE_DOMAIN_NAME is not defined, craete it. We will use it in config file.

You can define SITE_DOMAIN_NAME in .htaccess file, Anyway he need to be configured on every server separately.

*** public/.htaccess ***
...
SetEnv SITE_DOMAIN_NAME mysite.com
...

Further I set session values in config file
*** application/configs/application.ini ***
[production]
...
local.session.cookie_path = "/"
local.session.cookie_domain = "." SITE_DOMAIN_NAME
...
This line  "." SITE_DOMAIN_NAME  is equal to ".mysite.com"

And in Bootstrap.php wee initialize session.
*** application/Bootstrap.php ***
...
protected function _initSession()
{
$localCfg = new Zend_Config($this->getOption('local'), true);
Zend_Session::setOptions($localCfg->session->toArray());
Zend_Session::start();
}
...

среда, 9 февраля 2011 г.

Apache segmentation fault on local server

Problem in PHP while init session in script.
Solution:
  1. Change configs: /etc/php5/apache2/conf.d/suhosin.ini /etc/php5/conf.d/suhosin.ini
  2. Uncomment and edit line: suhosin.session.encrypt = off
  3. Restart apache: /etc/init.d/apache2 restart
URL:
Working for me!

Also solution update your apache server to newer version! Realy helps! :)