使用 php 的 apache 服务器的性能问题

发布于 2024-09-01 03:33:02 字数 3408 浏览 11 评论 0原文

我认为我的 apache 服务器存在性能问题。 我在 Solaris 10 上有 apache 服务器,带有 php 和一些 flash 客户端应用程序。 客户端通过 HTTPService 请求从服务器获取 XML 格式的数据。 有时数据未到达,有时数据到达。 可能是 apache 服务器或 php 中的性能(可能在 php.ini 文件中可配置) 这对我来说是一个严重的问题。请帮我。 此致。 埃拉德.

php.ini 配置文件:

[PHP]
cgi.fix_pathinfo = 1
memory_limit = 512M      ; Maximum amount of memory a script may consume (8MB)
default_socket_timeout = 180000
; Enable the PHP scripting language engine under Apache.
engine = On
safe_mode = Off

; include_path=/opt/coolstack/php5/lib/php:.:
include_path=/opt/OV/httpd/php5/lib/php:.:
; extension_dir=/opt/coolstack/php5/lib/php/extensions/no-debug-non-zts-20060613
extension_dir=/opt/OV/httpd/php5/lib/php/extensions/no-debug-non-zts-20060613
; CSKmysql32 is required for mysql and mysqli extensions.
extension="mysql.so"
extension="mysqli.so"
extension="apc.so"
extension="zlib.so"
extension=dom.so

;extension=bcmath.so
;extension=bz2.so
;extension=calendar.so
;extension=ctype.so
;extension=dbase.so
;extension=dtrace.so
;extension=exif.so
;extension=ftp.so
;extension=hash.so
;extension=iconv.so
;extension=imap.so
;extension=json.so
extension=ldap.so
;extension=mbstring.so
;extension=openssl.so
;extension=pcntl.so
;extension=pdo_pgsql.so
;extension=pgsql.so
;extension=posix.so
;extension=pspell.so
;extension=shmop.so
;extension=snmp.so
;extension=soap.so
;extension=sockets.so
;extension=sysvmsg.so
;extension=sysvsem.so
;extension=sysvshm.so
;extension=tokenizer.so
;extension=wddx.so
;extension=xmlreader.so
;extension=xmlwriter.so
;extension=xsl.so
;extension=zip.so
;extension=memcache.so
;extension=tcpwrap.so
;zend_extension="/opt/coolstack/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
; hardened-php - uncomment to enable. See http://hardened-php.net
;extension="suhosin.so"


; CSKlibs package is required for following extensions :
extension=curl.so
;extension=dba.so
;extension=gd.so
;extension=gettext.so
;extension=gmp.so
;extension=tidy.so
;extension=odbc.so
;extension=pdo_odbc.so

; CSKtds is required for following extensions :
;extension=pdo_dblib.so

; CSKncurses is required for following extensions :
;extension=ncurses.so
;extension=readline.so

; CSKmysql32 package is required for following extensions :
;extension=pdo_mysql.so

; CSKapache2 package is required for following extensions :
;extension=xmlrpc.so

apc.enabled=1
apc.shm_segments=1
apc.optimization=0
apc.shm_size=128
apc.ttl=120
apc.user_ttl=120
apc.gc_ttl=120
apc.stat=1
apc.num_files_hint=1024
apc.user_entries_hint=100
apc.mmap_file_mask=/dev/zero
;apc.enable_cli=1

; Allow or prevent persistent links.
;mysql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
;mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no limit.
;mysql.max_links = -1

[Session]
session.use_cookies = 1
session.cookie_lifetime = 0
session.gc_probability = 1
session.gc_divisor     = 5000
session.gc_maxlifetime = 6000
session.entropy_file = "/dev/urandom"
;session.cache_expire = 300
;session.cache_limiter = nocache
;session.save_path = "5;/tmp"

PHP 服务脚本代码例如:

class client
 {
    var $clientIP;

    function __construct()
    {
        $this->clientIP = $_SERVER['REMOTE_ADDR'];
    }

    public function get_client_info()
    {
        print "<clientIP>".$this->clientIP."</clientIP>\n";

    }
}

I think I have a performance problem in my apache server.
I have apache server on solaris 10 with php and some flash client applications.
The clients get data from server in XML formation with HTTPService requests.
sometimes the data doesn't arrive and sometimes it does.
maybe performance in the apache server or in the php (maybe its configurable in the php.ini file )
It's a serious problem for me. Please help me.
Best regards.
Elad.

php.ini Config file:

[PHP]
cgi.fix_pathinfo = 1
memory_limit = 512M      ; Maximum amount of memory a script may consume (8MB)
default_socket_timeout = 180000
; Enable the PHP scripting language engine under Apache.
engine = On
safe_mode = Off

; include_path=/opt/coolstack/php5/lib/php:.:
include_path=/opt/OV/httpd/php5/lib/php:.:
; extension_dir=/opt/coolstack/php5/lib/php/extensions/no-debug-non-zts-20060613
extension_dir=/opt/OV/httpd/php5/lib/php/extensions/no-debug-non-zts-20060613
; CSKmysql32 is required for mysql and mysqli extensions.
extension="mysql.so"
extension="mysqli.so"
extension="apc.so"
extension="zlib.so"
extension=dom.so

;extension=bcmath.so
;extension=bz2.so
;extension=calendar.so
;extension=ctype.so
;extension=dbase.so
;extension=dtrace.so
;extension=exif.so
;extension=ftp.so
;extension=hash.so
;extension=iconv.so
;extension=imap.so
;extension=json.so
extension=ldap.so
;extension=mbstring.so
;extension=openssl.so
;extension=pcntl.so
;extension=pdo_pgsql.so
;extension=pgsql.so
;extension=posix.so
;extension=pspell.so
;extension=shmop.so
;extension=snmp.so
;extension=soap.so
;extension=sockets.so
;extension=sysvmsg.so
;extension=sysvsem.so
;extension=sysvshm.so
;extension=tokenizer.so
;extension=wddx.so
;extension=xmlreader.so
;extension=xmlwriter.so
;extension=xsl.so
;extension=zip.so
;extension=memcache.so
;extension=tcpwrap.so
;zend_extension="/opt/coolstack/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
; hardened-php - uncomment to enable. See http://hardened-php.net
;extension="suhosin.so"


; CSKlibs package is required for following extensions :
extension=curl.so
;extension=dba.so
;extension=gd.so
;extension=gettext.so
;extension=gmp.so
;extension=tidy.so
;extension=odbc.so
;extension=pdo_odbc.so

; CSKtds is required for following extensions :
;extension=pdo_dblib.so

; CSKncurses is required for following extensions :
;extension=ncurses.so
;extension=readline.so

; CSKmysql32 package is required for following extensions :
;extension=pdo_mysql.so

; CSKapache2 package is required for following extensions :
;extension=xmlrpc.so

apc.enabled=1
apc.shm_segments=1
apc.optimization=0
apc.shm_size=128
apc.ttl=120
apc.user_ttl=120
apc.gc_ttl=120
apc.stat=1
apc.num_files_hint=1024
apc.user_entries_hint=100
apc.mmap_file_mask=/dev/zero
;apc.enable_cli=1

; Allow or prevent persistent links.
;mysql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
;mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no limit.
;mysql.max_links = -1

[Session]
session.use_cookies = 1
session.cookie_lifetime = 0
session.gc_probability = 1
session.gc_divisor     = 5000
session.gc_maxlifetime = 6000
session.entropy_file = "/dev/urandom"
;session.cache_expire = 300
;session.cache_limiter = nocache
;session.save_path = "5;/tmp"

PHP Service script code for example:

class client
 {
    var $clientIP;

    function __construct()
    {
        $this->clientIP = $_SERVER['REMOTE_ADDR'];
    }

    public function get_client_info()
    {
        print "<clientIP>".$this->clientIP."</clientIP>\n";

    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

≈。彩虹 2024-09-08 03:33:02

是不是实际服务器有问题?交换空间受到严重打击吗?大量IO等待? cpu满了?

或者只是 Apache 服务出现问题,而其他一切都运行良好?

如果是第一种情况,我会首先关闭 httpd.conf 文件中的 Apache 访问日志。这会大大减少 IO,并让 CPU 有时间处理其他事情。这样做的副作用是某些统计脚本无法正常工作。

Is it a problem with the actual server? Is it hitting swap heavily? lots of IO wait? cpu maxed out?

Or is it just the Apache service that is having issues, while everything else is running fine?

If it's the first case I would start by turning off Apache access logs in the httpd.conf file. That would reduce your IO by a lot, and would give the cpu time to deal with other stuff. Side effect of doing this is that some statistics scripts won't work correctly.

反目相谮 2024-09-08 03:33:02

好的。我意识到问题不在于服务器本身,而可能在于我的 Flash 客户端应用程序中。
我会发布一个关于它的正确问题。
谢谢你的帮助。
问候。
埃拉德.

OK. I realize that the problem is not the server itself but is probably in my Flash client application.
I'll post a proper question about it.
thank you for the help.
Regards.
Elad.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文