PHP开发环境 兄弟连小编整理如下:
Centos安装apache,mysql,php环境
yum -y install httpd php mysql mysql-server php-mysql php-devel mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql
这是系统默认版本的,如果想升级到更高,例如php5.6可以使用命令:
更新源:
CentOS/RHEL 7.x:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
CentOS/RHEL 6.x:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
删除之前安装的php
yum remove php-common
yum install php56w php56w-mysql php56w-dom php56w-gd php56w-bcmath php56w-mbstring php56w-ldap php56w-wddx php56w-xmlreader php56w-xmlrpc php56w-xmlwriter php56w-xsl php56w-xsl php56w-devel
apache,mysql服务启动和关闭命令
service httpd start
service httpd stop
service mysql start
service mysql stop
php56-* 可用的扩展参考这里:
https://webtatic.com/packages/php56/
Mac
Mac OS X 内置Apache 和 PHP,使用起来非常方便。
终端运行:
sudo apachectl start
mysql的安装
访问MySQL的官网,然后在页面中会看到"MySQL Community Server"下方有一个"download"点击。
常用扩展安装
Redis
centos下面:
pecl的安装请看:https://blog.iw3c.com/archive/994/
pecl install redis
echo extension=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下面:
pecl install mongo
echo extension=mongo.so >> /etc/php.ini
Memcached
centos下面:
pecl install memcached
echo extension=memcached.so >> /etc/php.ini