PHP开发环境 PHP培训教程
PHP开发环境兄弟连PHP培训小编整理如下:
Window:
1、XAMPP
https://www.apachefriends.org/index.html
2、WampServer
http://www.wampserver.com/
Linux
Centos安装apache,mysql,php环境
yum-yinstallhttpdphpmysqlmysql-serverphp-mysqlphp-develmod_sslmod_perlmod_auth_mysqlphp-gdphp-xmlphp-mbstringphp-ldapphp-pearphp-xmlrpcmysql-connector-odbcmysql-devellibdbi-dbd-mysql
这是系统默认版本的,如果想升级到更高,例如php5.6可以使用命令:
更新源:
CentOS/RHEL7.x:
rpm-Uvhhttps://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm-Uvhhttps://mirror.webtatic.com/yum/el7/webtatic-release.rpm
CentOS/RHEL6.x:
rpm-Uvhhttps://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm-Uvhhttps://mirror.webtatic.com/yum/el6/latest.rpm
删除之前安装的php
yumremovephp-common
yuminstallphp56wphp56w-mysqlphp56w-domphp56w-gdphp56w-bcmathphp56w-mbstringphp56w-ldapphp56w-wddxphp56w-xmlreaderphp56w-xmlrpcphp56w-xmlwriterphp56w-xslphp56w-xslphp56w-devel
apache,mysql服务启动和关闭命令
servicehttpdstart
servicehttpdstop
servicemysqlstart
servicemysqlstop
php56-*可用的扩展参考这里:
https://webtatic.com/packages/php56/
Mac
MacOSX内置Apache和PHP,使用起来非常方便。
终端运行:
sudoapachectlstart
mysql的安装
访问MySQL的官网,然后在页面中会看到"MySQLCommunityServer"下方有一个"download"点击。
常用扩展安装
Redis
centos下面:
pecl的安装请看:https://blog.iw3c.com/archive/994/
peclinstallredis
echoextension=redis.so>>/etc/php.ini
如果php.php不在默认位置,通过php-i|grep"php.ini"查看php.ini的具体所在位置。
Window:去https://pecl.php.net/package/redis下载最新的DLL包,放后放到PHP文件下的ext目录中,或者通过集成环境更智能的添加扩展
Mongo
centos下面:
peclinstallmongo
echoextension=mongo.so>>/etc/php.ini
Memcached
centos下面:
peclinstallmemcached
echoextension=memcached.so>>/etc/php.ini