搭建PHP开发环境
PHP集成开发环境有很多,如XAMPP、AppServ......只要一键安装就把PHP环境给搭建好了。但这种安装方式不够灵活,软件的自由组合不方便,同时也不利于学习。
一,准备——下载所需软件
1,Apache http://www.apachehaus.com/cgi-bin/download.plx
2,PHP http://windows.php.net/index.php
3,MySQL
PHP要选择thread safe 下载
二,开始安装并配置
1,PHP,Apache解压到选择的目录
2,配置Apache
在APache目录下的conf里编辑httpd.conf
在38行左右修改 Define SRVROOT "D:/2016/Apache24"
在75行左右添加
#LoadModule access_compat_module modules/mod_access_compat.so #PHP7 support LoadModule php7_module "D:/2016/PHP7/php7apache2_4.dll" AddType application/x-httpd-php .php .html .htm PHPIniDir "D:/2016/PHP7"
3,配置PHP
复制PHP目录下的php.ini-development并修改为php.ini
然后编辑php.ini;
; On windows: extension_dir = "D/2016/PHP7/ext"
;extension=php_bz2.dll extension=php_curl.dll ;extension=php_fileinfo.dll extension=php_gd2.dll ;extension=php_gettext.dll ;extension=php_gmp.dll ;extension=php_intl.dll ;extension=php_imap.dll ;extension=php_interbase.dll ;extension=php_ldap.dll extension=php_mbstring.dll extension=php_pgsql.dll ;extension=php_shmop.dll extension=php_xmlrpc.dll ;extension=php_xsl.dll
Centos7 通过yum安装mysql
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server -y
# service mysqld status看下是stop状态,执行service mysqld start启动
# /bin/systemctl/start mysqld.service
# /usr/bin/mysql -uroot mysql> set password for ‘root’@‘localhost’ = password('你需要设置的密码'); 如下设置密码为q1w2e3r4 成功后,再次登录需要输入密码才能登录
# systemctl list-unit-files 查看开启的服务
# systemctl enable mysqld 自动开启
远程访问:
例如,你想root使用123456从任何主机连接到mysql服务器。
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY‘123456’ WITH GRANT OPTION
如果你想允许用户xcx从ip为10.10.50.127的主机连接到mysql服务器,并使用654321作为密码
mysql>GRANT ALL PRIVILEGES ON *.* TO 'xcx'@’10.10.50.127’ IDENTIFIED BY '654321' WITH GRANT OPTION; mysql>FLUSH RIVILEGES
centos7通过yum安装PHP
# yum install php
安装php组件,使php支持mysql
# yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
stay hungry,stay foolish.