很多站长朋友们都不太清楚php依赖安装包,今天小编就来给大家整理php依赖安装包,希望对各位有所帮助,具体内容如下:
本文目录一览: 1、 源码编译安装php都需要哪些基础安装包 2、 php一键安装包怎么安装 3、 阿里云默认centos7上怎么安装php 4、 suse linux 怎么安装php运行环境 5、 如何在 CentOS 7 / Ubuntu 15.04 上安装 PHP 框架 Laravel 源码编译安装php都需要哪些基础安装包正常 记得 只有 openssl 看你要安装的扩展项 你用 configure --help 能看到 可以直接编译进源码的 扩展, 每增加 一个 --with-XX 就可能需要新的依赖包. 这个是可变的
php一键安装包怎么安装进入php源程序目录中的ext目录中,这里存放着各个扩展模块的源代码,选择你需要的模块,比如curl模块:cd curl
执行phpize生成编译文件,phpize在PHP安装目录的bin目录下
/usr/local/php5/bin/phpize
运行时,可能会报错:Cannot find autoconf. Please check your autoconf installation and
the $PHP_AUTOCONF
environment variable is set correctly and then rerun this
script.,需要安装autoconf:
yum install autoconf(RedHat或者CentOS)、apt-get install
autoconf(Ubuntu Linux)
/usr/local/php5/bin/php -v
执行这个命令时,php会去检查配置文件是否正确,如果有配置错误,
这里会报错,可以根据错误信息去排查!
阿里云默认centos7上怎么安装php首先更新系统软件</str>
$ yum update
安装nginx</str></str>
1.安装nginx源
$ yum localinstall .安装nginx
$ yum install nginx
3.启动nginx
$ service nginx start
Redirecting to /bin/systemctl start nginx.service4.访问http://你的ip/
如果成功安装会出来nginx默认的欢迎界面
安装MySQL5.7.*
</str>
1.安装mysql源</str>
$ yum localinstall .安装mysql
$ yum install mysql-community-server
确认一下mysql的版本,有时可能会提示mysql5.63.安装mysql的开发包,以后会有用
$ yum install mysql-community-devel
4.启动mysql
$ service mysqld start
Redirecting to /bin/systemctl start mysqld.service5.查看mysql启动状态
$ service mysqld status
出现pid
证明启动成功
6.获取mysql默认生成的密码
$ grep 'temporary password' /var/log/mysqld.log2015-12-05T05:41:09.104758Z 1 [Note] A temporary password is generated for root@localhost: %G1Rgns!dD!v</str>
加粗的就是生成的密码
7.换成自己的密码
$ mysql -uroot -p
Enter password:输入上面的密码
成功输入后进入一下步,这里你估计会输入 好几次才进去8. 更换密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';这个密码一定要足够复杂,不然会不让你改,提示密码不合法;9.退出mysql;
mysql> quit;
10.用新密码再登录,试一下新密码
$ mysql -uroot -p
Enter password:输入你的新密码
11.确认密码正确后,退出mysql;
mysql> quit;
编译安装php7.0.0
</str>
</str>
1.下载php7源码包</str>
$ cd /root wget -O php7.tar.gz .解压源码包</str>
$ tar -xvf php7.tar.gz
3.</str>
$ cd php-7.0.1
4.安装php依赖包</str>
</str>
$ yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel5.编译配置,这一步我们会遇到很多configure error,我们一一解决,基本都是相关软件开发包没有安装导致</str>
</str>
$ ./configure \
--prefix=/usr/local/php \
--with-config-file-path=/etc \
--enable-fpm \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-exif \
--enable-fileinfo \
--enable-filter \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-openssl-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-freetype-dir \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-json \
--enable-mbstring \
--enable-mbregex \
--enable-mbregex-backtrack \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-zlib-dir \
--with-pdo-sqlite \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-opcache
configure error:
1.configure: error: xml2-config not found. Please check your libxml2 installation.
解决:
$ yum install libxml2 libxml2-devel
2.configure: error: Cannot find OpenSSL's <evp.h>
解决:
$ yum install openssl openssl-devel
3.configure: error: Please reinstall the BZip2 distribution解决:
$ yum install bzip2 bzip2-devel
4.configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/解决:
$ yum install libcurl libcurl-devel
5.If configure fails try --with-webp-dir=<DIR> configure: error: jpeglib.h not found.
解决:
$ yum install libjpeg libjpeg-devel
6.If configure fails try --with-webp-dir=<DIR>
checking for jpeg_read_header in -ljpeg... yesconfigure: error: png.h not found.
解决:
$ yum install libpng libpng-devel
7.If configure fails try --with-webp-dir=<DIR>
checking for jpeg_read_header in -ljpeg... yeschecking for png_write_image in -lpng... yesIf configure fails try --with-xpm-dir=<DIR>
configure: error: freetype-config not found.
解决:
$ yum install freetype freetype-devel
8.configure: error: Unable to locate gmp.h解决:
$ yum install gmp gmp-devel
9.configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决:
$ yum install libmcrypt libmcrypt-devel
10.configure: error: Please reinstall readline - I cannot find readline.h解决:
$ yum install readline readline-devel
11.configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution解决:
$ yum install libxslt libxslt-devel
6.编译与安装
$ make make install
这里要make好久,要耐心一下
7.添加 PHP 命令到环境变量
$ vim /etc/profile
在末尾加入
PATH=$PATH:/usr/local/php/bin
export PATH
要使改动立即生效执行
$ ./etc/profile
或
$ source /etc/profile
查看环境变量
$ echo $PATH
查看php版本
$ php -v
8.配置php-fpm
$ cp php.ini-production /etc/php.ini
$ cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf$ cp /usr/local/php/etc/php-fpm.d/ /usr/local/php/etc/php-fpm.d/ cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm$ chmod +x /etc/init.d/php-fpm
9.启动php-fpm
$ /etc/init.d/php-fpm start
配置nginx虚拟机,绑定域名</str>
1.
</str>
$ vim /etc/nginx/conf.d/php7.thinkcmf测试数据.conf这里可以把php7.thinkcmf测试数据.conf改成自己的域名把下面的内容复制到php7.thinkcmf测试数据.conf里server{
listen 80;
server_name php7.thinkcmf测试数据;
root /var/www/html/php7.thinkcmf测试数据; # 该项要修改为你准备存放相关网页的路径location / {
index index.php index.html index.htm;
#如果请求既不是一个文件,也不是一个目录,则执行一下重写规则if (!-e $request_filename)
{
#地址作为将参数rewrite到index.php上。
rewrite ^/(.*)$ /index.php/$1;
#若是子目录则使用下面这句,将subdir改成目录名称即可。
#rewrite ^/subdir/(.*)$ /subdir/index.php/$1;}
}
#proxy the php scripts to php-fpm
location ~ \.php {
include fastcgi_params;
##pathinfo支持start
#定义变量 $path_info ,用于存放pathinfo信息set $path_info "";
#定义变量 $real_script_name,用于存放真实地址set $real_script_name $fastcgi_script_name;#如果地址与引号内的正则表达式匹配
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {#将文件地址赋值给变量 $real_script_name
set $real_script_name $1;
#将文件地址后的参数赋值给变量 $path_info
set $path_info $2;
}
#配置fastcgi的一些参数
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;fastcgi_param SCRIPT_NAME $real_script_name;fastcgi_param PATH_INFO $path_info;
###pathinfo支持end
fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:9000;
}
}
2.重启nginx
$ service nginx reload
3.
$ vim /var/www/html/php7.thinkcmf测试数据/index.php</str>
把下面的代码复制到这个文件 里
<?php
phpinfo();
4.查看访问
suse linux 怎么安装php运行环境SuSE Linux上搭建apache+php+mysql环境
1.安装apache
apache安装包:httpd-2.2.9.tar.gz,安装步骤如下:
1) ./configure --prefix=/usr/local/httpd-2.2.9
2) make
3) make install
2.安装mysql
直接使用mysql非RPM二进制安装包,如:mysql-5.1.36-linux-i686-glibc23.tar.gz,具体步骤如下:
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql
3.安装php依赖库
libxml2,expat,gd,gettext,这几个依赖库的安装使用标准的automake安装方式。
4. 安装php
php安装包:php-5.2.6.tar.gz,安装步骤如下:
1) ./configure --prefix=/usr/local/php-5.2.6 --enable-mbstring=LANG --with-mysql=/usr/local/mysql --with-gd=/usr/local/gd --with-gettext=/usr/local/gettext --with-libxml-dir=/usr/local/libxml2 --with-libexpat-dir=/usr/local/expat --with-apxs2=/usr/local/httpd/bin/apxs
参数--with-apxs2=/usr/local/httpd/bin/apxs是为了生成libphp5.so文件,所以是必须的。
2) make
3) make install
安装完成后把php.ini-dist复制到/usr/local/php/lib/,并重命名为php.ini。基本到这里PHP就安装成功了,如果中间出现错误,除了在配置的时候没有选对选项之后一般都不出现错误。
5.修改apache配置文件httpd.conf,添加如下两行:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
并确保文件中有以下一句话,没有就自己添加在所有LoadModule之后:
LoadModule php5_module modules/libphp5.so
6.启动apache
#/usr/local/httpd/bin/apachectl restart
如何在 CentOS 7 / Ubuntu 15.04 上安装 PHP 框架 Laravel在 CentOS 7 / Ubuntu 15.04 上安装 Laravel。如果你是一个 PHP Web 的开发者,你并不需要考虑如何在琳琅满目的现代 PHP 框架中选择,Laravel 是最轻松启动和运行的,它省时省力,能让你享受到 web 开发的乐趣。Laravel 信奉着一个普世的开发哲学,通过简单的指导创建出可维护代码是最优先的,你将保持着高速的开发效率,能够随时毫不畏惧更改你的代码来改进现有功能。
Laravel 安装并不繁琐,你只要跟着本文章一步步操作就能在 CentOS 7 或者 Ubuntu 15 服务器上安装。
1) 服务器要求
在安装 Laravel 前需要安装一些它的依赖前提条件,主要是一些基本的参数调整,比如升级系统到最新版本,sudo 权限和安装依赖包。
当你连接到你的服务器时,请确保你能通以下命令能成功的使用 EPEL 仓库并且升级你的服务器。
CentOS-7
#yum install epel-release
# rpm -Uvh
# rpm -Uvh
#yum update
Ubuntu
#apt-get install python-software-properties
# add-apt-repository ppa:ondrej/php5
#apt-get update
#apt-get install -y php5 mcrypt php5-mcrypt php5-gd
2) 防火墙安装
系统防火墙和 SELinux 设置对于用于产品应用安全来说非常重要,当你使用测试服务器的时候可以关闭防火墙,用以下命令行设置 SELinux 成宽容模式(permissive)来保证安装程序不受它们的影响。
#setenforce0
3) Apache, MariaDB, PHP 安装
Laravel 安装程序需要完成安装 LAMP 整个环境,需要额外安装 OpenSSL、PDO,Mbstring 和 Tokenizer 等 PHP 扩展。如果 LAMP 已经运行在你的服务器上你可以跳过这一步,直接确认一些必要的 PHP 插件是否安装好。
要安装完整 AMP 你需要在自己的服务器上运行以下命令。
CentOS
#yum install httpd mariadb-server php56w php56w-mysql php56w-mcrypt php56w-dom php56w-mbstring
要在 CentOS 7 上实现 MySQL / Mariadb 服务开机自动启动,你需要运行以下命令。
#systemctl start httpd
#systemctl enable httpd
#systemctl start mysqld
#systemctl enable mysqld
在启动 MariaDB 服务之后,你需要运行以下命令配置一个足够安全的密码。
#mysql_secure_installation
Ubuntu
#apt-get install mysql-server apache2 libapache2-mod-php5 php5-mysql
4) 安装 Composer
在我们安装 Laravel 前,先让我们开始安装 composer。安装 composer 是安装 Laravel 的最重要步骤之一,因为 composer 能帮我们安装 Laravel 的各种依赖。
CentOS/Ubuntu
在 CentOS / Ubuntu 下运行以下命令来配置 composer 。
# curl -sS | php
#mv composer.phar /usr/local/bin/composer
#chmod+x /usr/local/bin/composer
composer installation
composer installation
5) 安装 Laravel
我们可以运行以下命令从 github 上下载 Laravel 的安装包。
#wget
运行以下命令解压安装包并且移动 document 的根目录。
# unzip develop.zip
#mv laravel-develop /var/www/
现在使用 compose 命令来安装目录下所有 Laravel 所需要的依赖。
#cd/var/www/laravel-develop/
# composer install
compose laravel
compose laravel
6) 密钥
为了加密服务器,我们使用以下命令来生成一个加密后的 32 位的密钥。
# php artisan key:generate
Application key [Lf54qK56s3qDh0ywgf9JdRxO2N0oV9qI]set successfully
现在把这个密钥放到 'app.php' 文件,如以下所示。
#vim/var/www/laravel-develop/config/app.php
Key encryption
Key encryption
7) 虚拟主机和所属用户
在 composer 安装好后,分配 document 根目录的权限和所属用户,如下所示。
#chmod775/var/www/laravel-develop/app/storage
#chown-R apache:apache /var/www/laravel-develop
用任意一款编辑器打开 apache 服务器的默认配置文件,在文件最后加上虚拟主机配置。
#vim/etc/httpd/conf/httpd.conf
ServerName laravel-develop
DocumentRoot/var/www/laravel/public
start Directory/var/www/laravel
AllowOverrideAll
Directory close
现在我们用以下命令重启 apache 服务器,打开浏览器查看 localhost 页面。
CentOS
#systemctl restart httpd
Ubuntu
# service apache2 restart
8) Laravel 5 网络访问
打开浏览器然后输入你配置的 IP 地址或者完整域名(Fully qualified domain name)你将会看到 Laravel 5 的默认页面。
Laravel Default
Laravel Default
总结
Laravel 框架对于开发网页应用来说是一个绝好的的工具。所以,看了这篇文章你将学会在 Ubuntu 15 和 CentOS 7 上安装 Laravel, 之后你就可以使用这个超棒的 PHP 框架提供的各种功能和舒适便捷性来进行你的开发工作。
关于php依赖安装包的介绍到此就结束了,不知道本篇文章是否对您有帮助呢?如果你还想了解更多此类信息,记得收藏关注本站,我们会不定期更新哦。