1. PHP基础介绍
初识PHP
参考地址
php中文网:http://www.php.cn/
php中国开发者社区:http://www.phpchina.com/
版本
当前最新版本7.3.x,历史常用版本5.2.17~5.6.x
服务器
phpstudy、lamp、Apache、Nginx等
开发辅助工具
https://php.net/ //php在线查找帮助,包含php所有方法函数用法及说明,非常全面
常用操作指令
- 查看php版本: # php -v
- 查看php环境及配置信息: # php -ini|more
- 查看php加载扩展模块:# php -m
魔术常量
- __LINE__ //当前的行数
- __FILE__ //当前文件绝对路径及文件名
- __DIR__ //当前文件绝对路径
- __CLASS__ //当前的类名
- __FUNCTION__ //当前的函数(方法)名
- __METHOD__ //类的方法名
- __NAMESPACE__ //命名空间[不常用]
2. PHP安装
当前系统环境:centos 7.4
# nohup wget -c https://www.php.net/distributions/php-7.2.17.tar.gz -b &
(wget https://www.php.net/distributions/php-7.2.17.tar.gz)
//注:下载有些慢,不可中断。约19M左右,若下载不完整,解压会报错,若存在问题,可用下载工具下载完整后上传
# tar zxvf php-7.2.17.tar.gz
# cd php-7.2.17
# ./configure --help
# ./configure --prefix=/usr/local/php72 --enable-fpm \--enable-mbstring --enable-pdo --with-curl --disable-debug --disable-rpath \--enable-inline-optimization --with-bz2 --with-zlib --enable-sockets \--enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex \--with-mhash --with-mysqli \--with-gd --with-jpeg-dir --with-freetype-dir --enable-calendar
(参考:\--with-curl \--with-freetype-dir \--with-gd \--with-gettext \--with-iconv-dir \--with-kerberos \--with-libdir=lib64 \--with-libxml-dir \--with-mysqli \--with-openssl \--with-pcre-regex \--with-pdo-mysql \--with-pdo-sqlite \--with-pear \--with-png-dir \--with-xmlrpc \--with-xsl \--with-zlib \--enable-fpm \--enable-bcmath \--enable-libxml \--enable-inline-optimization \--enable-gd-native-ttf \--enable-mbregex \--enable-mbstring \--enable-opcache \--enable-pcntl \--enable-shmop \--enable-soap \--enable-sockets \--enable-sysvsem \--enable-xml \--enable-zip)
# make && make install
3. PHP代码
<?php
echo phpinfo();
?>
持续完善,待续...