1分钟完美安装最新 CentOS + Nginx + PHP FPM + MySQL
PHP 5.3.1
MySQL 5.0.89
Nginx 0.8.33 或 0.7.65 (可选)
现在,我们可以快速全自动搞定 CentOS + Nginx + PHP-FPM + MySQL 的安装了
这个可比网上流传的什么一键安装包要好得多,强烈推荐此法安装,适合所有菜鸟和高手
我服务器上全用的源代码编译安装,也好不到哪去,还很费劲
我这个装完已经包含 php 的一些常用扩展, PDO,eaccelerator,memcache,tidy等等
本文为 21andy.com原创,转载请以超级链接方式注明出处 http://www.21andy.com
先新建一个 repo
# vi /etc/yum.repos.d/centos.21andy.com.repo
放入如下内容
[21Andy.com]
name=21Andy.com Packages for Enterprise Linux 5 - $basearch
baseurl=http://www.21andy.com/centos/5/$basearch/
enabled=1
gpgcheck=0
protect=1
启用 EPEL repo
i386
rpm -ihv http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
x86_64
rpm -ihv http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm
接着导入key
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
好了,一键安装
# yum install nginx php-fpm mysql-server
爽吧!
如果 nginx 你要用 0.7.65 最新稳定版,把
yum -y install nginx
换成
yum -y install nginx-stable
就可以了
本文为 21andy.com原创,转载请以超级链接方式注明出处 http://www.21andy.com
更完整的安装
yum -y update
yum -y mysql-server
service mysqld start
mysqladmin -u root password root
service mysqld stop
yum -y install nginx php-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml php-xmlrpc php-pear php-pecl-memcache php-eaccelerator
# APC 和 eAccelerator 有冲突,2选1
yum -y install php-pecl-apc
看下我的完整安装,只要一句
yum
相关文档:
本文适合CentOS。一步一步来,不要错。
先下载工具ssh shell,个人感觉这个比较好用,推荐给大家
http://docs.isvps.net/soft/SSHSecureShellClient-3.2.9.zip
然后是一些必要的软件包
nginx源码包: http://www.nginx.org/download/nginx-0.7.65.tar.gz
php源码包: http://cn.php.net/distributions/php-5.2.11.tar.gz ......
<pre>
PHP代码
<?php
// 例子1
function test_global() {
global $var1, $var2;
$var2 =& $var1;
}
function test_globals() {
......
安装curl
1. curl 是 php 標準庫,所以可以在原來的 phpX.X.X.tar.gz 中找到。
2. 進入 php 目錄中的 ext 找到 curl
3. 在 curl 目錄中執行 /usr/local/php5-fastcgi/bin/phpize
4. 再來將他生成的檔案進行 ./con ......
$str=preg_replace("/\s+/", " ", $str); //过滤多余回车
$str=preg_replace("/<[ ]+/si","<",$str); //过滤<__("<"号后面带空格)
$str=preg_replace("/<\!--.*?-->/si","",$str); //注释
$str=preg_replace("/<(\!.*?)>/si","",$s ......
PHP 的 $_GET 和 $_POST 用于检索表单中的值,比如用户输入。
PHP 表单处理
表单实例:
<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
......