php centos 并发,CentOS+Nginx+MySql+PHP搭建高并发网站服务器时遇到的问题备忘

本文详细记录了在搭建LNMP(Linux + Nginx + MySQL + PHP)服务器过程中遇到的问题,包括MySQL配置错误、PHP扩展加载失败、内存限制问题以及Nginx启动冲突等。通过分享解决这些问题的步骤,帮助读者理解并解决类似问题。
摘要由CSDN通过智能技术生成

最近关注LNMP的搭建服务器技术,并自己独立组建网站服务器,我将遇到的问题列出来以便日后参考,往后我会随时更新博客。

/data0/mysql/3306/mysql: line 28: unexpected EOF while looking for matching `)'

/data0/mysql/3306/mysql: line 42: syntax error: unexpected end of file

[root@localhost 3306]# error: Found option without preceding group in config file: /data0/mysql/3306/my.cnf at line: 1

Fatal error in defaults handling. Program aborted

WARNING: Defaults file '/data0/mysql/3306/my.cnf' not found!

error: Found option without preceding group in config file: /data0/mysql/3306/my.cnf at line: 1

Fatal error in defaults handling. Program aborted

WARNING: Defaults file '/data0/mysql/3306/my.cnf' not found!

touch: cannot touch `/usr/local/webserver/mysql/var/localhost.localdomain.err': No such file or directory

chown: cannot access `/usr/local/webserver/mysql/var/localhost.localdomain.err': No such file or directory

/usr/local/webserver/mysql/bin/mysqld_safe: line 107: /usr/local/webserver/mysql/var/localhost.localdomain.err: No such file or directory

/usr/local/webserver/mysql/bin/mysqld_safe: line 144: /usr/local/webserver/mysql/var/localhost.localdomain.err: No such file or directory

/usr/local/webserver/mysql/bin/mysqld_safe: line 107: /usr/local/webserver/mysql/var/localhost.localdomain.err: No such file or directory

connect to server at 'localhost' failed

error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'

Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists

解决方法: ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

[root@localhost etc]# /usr/local/webserver/php/sbin/php-fpm start

Starting php_fpm PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/pdo.mysql.so' - /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/pdo.mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0

eAccelerator: Could not allocate 67108864 bytes, the maximum size the kernel allows is 33554432 bytes. Lower the amount of memory request or increase the limit in /proc/sys/kernel/shmmax.

PHP Warning: [eAccelerator] Can not create shared memory area in Unknown on line 0

PHP Fatal error: Unable to start eAccelerator module in Unknown on line 0

failed

[root@localhost /]# /usr/local/webserver/php/sbin/php-fpm start

Starting php_fpm eAccelerator: Could not allocate 67108864 bytes, the maximum size the kernel allows is 33554432 bytes. Lower the amount of memory request or increase the limit in /proc/sys/kernel/shmmax.

PHP Warning: [eAccelerator] Can not create shared memory area in Unknown on line 0

PHP Fatal error: Unable to start eAccelerator module in Unknown on line 0

failed

解决方法:echo 128000000 > /proc/sys/kernel/shmmax

[root@localhost sbin]# /usr/local/webserver/nginx/sbin/nginx

[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)

[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)

[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)

[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)

[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)

[emerg]: still could not bind()

[root@localhost ~]# /usr/local/webserver/nginx/sbin/nginx

[warn]: conflicting server name "192.168.208.131" on 0.0.0.0:80, ignored

[root@localhost ~]# service nginx start

nginx: unrecognized service

502 bad gateway!

no input file specified

403 Forbidden

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值