douba1617 2013-03-15 02:42
浏览 156
已采纳

Apache模块mpm_worker + php问题

I am using php and apache in ubuntu machine and trying multi threading concepts. Apache comes with defaut "prefork" module. And When I enable mpm_worker module , Php stops working..

Do I need to enable any other modules to make php working when mpm_worker enabled in apache.

Thank you..

  • 写回答

1条回答 默认 最新

  • dpgui8229808 2013-03-15 07:14
    关注

    if anyone faces the same issue check this article:

    1. Install apache2-mpm-worker and the fastcgi apache module libapache-mod-fcid
    
    Code:
    # apt-get install apache2-mpm-worker  libapache2-mod-fcgid2. Enable the Fastcgi apache module mod_fcgid
    
    Code:
    # sudo a2enmod fcgid3. Install php5-cgi and the command-line version php5-cli
    
    
    Code:
    # sudo aptitude install php5-cgi php5-cli4. Add the following to /etc/apache2/httpd.conf or place these basic configuration settings in a file under /etc/apache2/conf.d. For example, /etc/apache2/conf.d/00-myconf ("00-" will help insure it is read first before other /etc/apache2/conf.d files, which is necessary).    
    
    Code:
    <Directory /var/www>
    AddHandler fcgid-script .php
    FCGIWrapper /usr/lib/cgi-bin/php5 .php
    Options +ExecCGI
    </Directory>
    # If you have Aliases provide php support for them (Here we provide php support for scripts in /usr/share's subdirectories)
    Alias /aptitude /usr/share/doc/aptitude/html/en
    Alias /apt /usr/share/doc/apt-doc
    
    <Directory /usr/share>
    AddHandler fcgid-script .php
    FCGIWrapper /usr/lib/cgi-bin/php5 .php
    Options ExecCGI FollowSymlinks Indexes
    </Directory>5. Then, for each virtual host configuration file you have in /etc/apache2/sites-available, add ExecCGI within a <Directoy /path-to-site> block (placed within your <VirtualHost> block). For example, 
    
    # cat /etc/apache2/sites-availabe/yourdomain.com
    
    Code:
    <VirtualHost *:80>
    ServerAdmin youremail@yourdomain.com
    ServerName yoursite.tld
    ServerAlias www.yourdomain.tld *.yourdomain.tld
    
    DocumentRoot /var/www/yourdomain.com
    
    ErrorLog        /var/log/apache2/yourdomain.tld-error.log
    CustomLog       /var/log/apache2/yourdomain.tld-access.log combined
    
    <Directory /var/www/yourdomain.com>
    Options +ExecCGI 
    
    AllowOverride All
    Order Allow,Deny
    allow from all
    </Directory>
    LogLevel warn
    ServerSignature On
    </VirtualHost>Note: ExecCGI was turned on in /etc/apache2/sites-available/default for /var/www and its subdirectories, so it is not strictly necessary within the <VirtualHost > block shown here. Using +ExecCGI adds fastcgi support to the Options in force. Options don't merge with prior options (they replace them) unless + is used. You can specify entirely different Options, but you must at a minmum have ExecCGI, if you want php support for your virtual host.
    
    6. For any other <Directory /some/other/path> blocks you have, say, for virtual hosts, which are not subdirectories of /var/www or /usr/share, add 
    
    <Directory /some/other/path>
    AddHandler fcgid-script .php
    FCGIWrapper /usr/lib/cgi-bin/php5 .php
    Options +ExecCGI 
    # add other Options you might need, but ExecCGI is required
    # . . .
    </Directory>
    
    7. Enable your virtual host    
    
    Code:
    #sudo a2ensite yourdomain.com7. And reload the apache configuration
    
    Code:
    # sudo /etc/init.d/apache2 force-reloador just restart apache2
    
    Code:
    # sudo /etc/init.d/apache2 restart
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化