安装编译工具: sudo zypper update sudo zypper install gcc gcc-c++ make 安装Apache: sudo zypper in apache2 sudo systemctl start apache2.service sudo systemctl enable apache2.service 设置默认文档路径: sudo vi /etc/apache2/default-server.conf 创建测试页面: cd /srv/www/htdocs sudo vi index.html 输入: hello world! 访问 http://localhost/ 查看 安装PHP: sudo zypper in php5 php5-devel apache2-mod_php5 Enable mod-php: sudo /usr/sbin/a2enmod php5 Enable mod-rewrite: sudo /usr/sbin/a2enmod rewrite 要想支持 rewrite 还需要同时在 Apache 配置文件里设置: Options +FollowSymLinks AllowOverride all 创建测试页面: cd /srv/www/htdocs sudo vi index.php 输入: <?php phpinfo(); ?> 访问 http://localhost/index.php 查看 设置PHP环境: sudo vi /etc/php5/apache2/php.ini date.timezone = PRC display_errors = On 安装PHP模块: sudo zypper in php5-bcmath php5-gd libjpeg8* php5-intl php5-ldap php5-mysql php5-mbstring php5-mcrypt php5-odbc php5-pdo php5-pear pcre-devel php5-soap php5-xmlrpc 安装 php-apc: sudo pecl install apc sudo vi /etc/php5/conf.d/apc.ini 添加:extension=apc.so 安装 php-memcache: sudo pecl install memcache sudo vi /etc/php5/conf.d/memcache.ini 添加:extension=memcache.so 安装 Xdebug: 源码下载地址 http://xdebug.org/download.php 解压 cd xdebug-2.2.4 phpize ./configure make sudo make install sudo vi /etc/php5/conf.d/xdebug.ini 添加: zend_extension=/usr/lib64/php5/extensions/xdebug.so 参考Fedora 安装MariaDB: sudo zypper in mariadb mariadb-tools sudo systemctl start mysql.service sudo systemctl enable mysql.service 设置时区: vi /etc/my.cnf 在 [mysqld] 节点添加: default-time_zone = '+8:00' 设置密码: mysqladmin -u root password NEWPASSWORD 安装MySQL: (如果先安装了MariaDB并卸载之后再安装MySQL,有可能会提示升级失败,则需先导出全部数据,并删除旧版本数据:sudo rm -rf /var/lib/mysql/) sudo zypper install mysql-community-server mysql-community-server-client mysql-community-server-errormessages sudo systemctl start mysql sudo mysql_secure_installation 安装Memcache: sudo zypper install memcached sudo systemctl start memcached.service sudo systemctl enable memcached.service