导航:首页 > 编程语言 > centosphp安装路径

centosphp安装路径

发布时间:2022-09-04 19:35:44

⑴ 我的vps已安装了centos-7.6-x86_64,怎样安装php扩展

为了让网站成功运行,就需要在php中增加bcmath这个扩展(其实默认的php中已经存在bcmath扩展,但是没有安装编译
安装php的扩展bcmath具体步骤如下(以下操作均在wdcp 2.4的环境中):
1、ssh登陆vps控制台后,进入要安装的扩展的源码目录:cd /root/lanmp/php-5.2.17/ext/bcmath
2、运行phpize,这是wdcp中的路径: /www/wdlinux/php/bin/phpize
出现如下提示:
configuring for:
php api version:
20041225
zend mole api no: 20060613
zend extension api no: 220060519
3、编译安装:
./configure --with-php-config=/www/wdlinux/php/bin/php-config
make
make install
4、增加到配置文件php.ini里
vi /www/wdlinux/etc/php.ini
在最后增加:extension=bcmath.so
5、重启服务
service httpd restart
service nginxd restart
然后就大功告成

⑵ 阿里云默认centos7上怎么安装php

首先更新系统软件</str>
$ yum update
安装nginx</str></str>
1.安装nginx源
$ yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm2.安装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 http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm2.安装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 http://cn2.php.net/get/php-7.0.1.tar.gz/from/this/mirror2.解压源码包</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-proction /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/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf$ 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.com.conf这里可以把php7.thinkcmf.com.conf改成自己的域名把下面的内容复制到php7.thinkcmf.com.conf里server{
listen 80;
server_name php7.thinkcmf.com;
root /var/www/html/php7.thinkcmf.com; # 该项要修改为你准备存放相关网页的路径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.com/index.php</str>
把下面的代码复制到这个文件 里
<?php
phpinfo();
4.查看访问http://php7.thinkcmf.com

⑶ centos下安装了php没有报错为什么找不到安装目录

理论上来说这种可能性应该是不存在的!
make没有?
make ZEND_EXTRA_LIBS='-liconv'
make install
再试试!

⑷ CentOS下查看某个软件安装在哪个目录

以redhat\centos 中php-mysql为例
1:如果包是通过yum或者rpm方式安装
[root@localhost yum.repos.d]# rpm -qa //找出系统所有的包,找到对应的文件名

[root@localhost yum.repos.d]# rpm -ql php-mysql-5.4.16-23.el7_0.3.x86_64
/etc/php.d/mysql.ini
/etc/php.d/mysqli.ini
/etc/php.d/pdo_mysql.ini
/usr/lib64/php/moles/mysql.so
/usr/lib64/php/moles/mysqli.so
/usr/lib64/php/moles/pdo_mysql.so

2:如果是源码编译安装
2.1源码安装的方式通过rpm命令是无法找出来的,如果你确定这个软件已经开启,则可以通过
[root@localhost yum.repos.d]# ps -aux 找出对一个的可执行文件所在的目录
2.2通常安装完包后,我们都会把他加入到服务里面,你可以去/etc/rc.d/下找相应的文件,进而确认相关信息。

最后一种最笨的方法就是用find命令
find / -name *文件名*

⑸ 如何在CentOS 6上通过YUM安装Nginx和PHP-FPM

准备篇:

1、配置防火墙,开启80端口、3306端口
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT(允许80端口通过防火墙)
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT(允许3306端口通过防火墙)
特别提示:很多网友把这两条规则添加到防火墙配置的最后一行,导致防火墙启动失败,正确的应该是添加到默认的22端口这条规则的下面
添加好之后防火墙规则如下所示:
#########################################################

#-config-firewall
#.
*filter
:INPUTACCEPT[0:0]
:FORWARDACCEPT[0:0]
:OUTPUTACCEPT[0:0]
-AINPUT-mstate--stateESTABLISHED,RELATED-jACCEPT
-AINPUT-picmp-jACCEPT
-AINPUT-ilo-jACCEPT
-AINPUT-mstate--stateNEW-mtcp-ptcp--dport22-jACCEPT
-AINPUT-mstate--stateNEW-mtcp-ptcp--dport80-jACCEPT
-AINPUT-mstate--stateNEW-mtcp-ptcp--dport3306-jACCEPT
-AINPUT-jREJECT--reject-withicmp-host-prohibited
-AFORWARD-jREJECT--reject-withicmp-host-prohibited
COMMIT


#########################################################
/etc/init.d/iptables restart #最后重启防火墙使配置生效

2、关闭SELINUX
vi /etc/selinux/config
#SELINUX=enforcing #注释掉
#SELINUXTYPE=targeted #注释掉
SELINUX=disabled #增加
:wq 保存,关闭
shutdown -r now #重启系统

3、配置CentOS 6.2 第三方yum源(CentOS默认的标准源里没有nginx软件包)
yum install wget #安装下载工具wget

wgethttp://www.atomicorp.com/installers/atomic

#下载atomic yum源
sh ./atomic #安装
yum check-update #更新yum软件包
################################################################
安装篇:

一、安装nginx
yum install nginx #安装nginx,根据提示,输入Y安装即可成功安装
service nginx start #启动
chkconfig nginx on #设为开机启动
/etc/init.d/nginx restart #重启
rm -rf /usr/share/nginx/html/* #删除ngin默认测试页

二、安装MySQL
1、安装mysql

yum install mysql mysql-server #询问是否要安装,输入Y即可自动安装,直到安装完成
/etc/init.d/mysqld start #启动MySQL
chkconfig mysqld on #设为开机启动
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf #拷贝配置文件(注意:如果/etc目录下面默认有一个my.cnf,直接覆盖即可)
shutdown -r now #重启系统

2、为root账户设置密码
mysql_secure_installation
回车,根据提示输入Y
输入2次密码,回车
根据提示一路输入Y
最后出现:Thanks for using MySQL!

MySql密码设置完成,重新启动 MySQL:
/etc/init.d/mysqld stop #停止
/etc/init.d/mysqld start #启动
service mysqld restart #重启

三、安装PHP
1、安装PHP
yum install php #根据提示输入Y直到安装完成
2、安装PHP组件,使PHP支持 MySQL、PHP支持FastCGI模式

yuminstallphp-mysqlphp-gdlibjpeg*php-imapphp-ldapphp-odbcphp-pearphp-xmlphp-xmlrpcphp-mbstringphp-mcryptphp-bcmathphp-mhashlibmcryptlibmcrypt-develphp-fpm

#根据提示输入Y回车
/etc/init.d/mysqld restart #重启MySql
/etc/init.d/nginx restart #重启nginx
/etc/rc.d/init.d/php-fpm start #启动php-fpm
chkconfig php-fpm on #设置开机启动
################################################################
配置篇

一、配置nginx支持php
cp /etc/nginx/nginx.conf /etc/nginx/nginx.confbak #备份原有配置文件
vi /etc/nginx/nginx.conf #编辑
user nginx nginx;#修改nginx运行账号为:nginx组的nginx用户
:wq! #保存退出

cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.confbak #备份原有配置文件
vi /etc/nginx/conf.d/default.conf #编辑

index index.php index.html index.htm;#增加index.php

#.0.0.1:9000
#
location~.php${
roothtml;
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;
includefastcgi_params;
}


#取消FastCGI server部分location的注释,并要注意fastcgi_param行的参数,改为$document_root$fastcgi_script_name,或者使用绝对路径

二、配置php

vi /etc/php.ini #编辑

date.timezone = PRC #在946行 把前面的分号去掉,改为date.timezone = PRC

disable_functions=passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname


#在386行 列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用。
expose_php = Off #在432行 禁止显示php版本的信息
magic_quotes_gpc = On #在745行 打开magic_quotes_gpc来防止SQL注入
open_basedir = .:/tmp/ #在380行,设置表示允许访问当前目录(即PHP脚本文件所在之目录)和/tmp/目录,可以防止php木马跨站,如果改了之后安装程序有问题,可注销此行,或者直接写上程序目录路径/var/www/html/www.osyunwei.com/:/tmp/
:wq! #保存退出

三、配置php-fpm

cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.confbak #备份原有配置文件
vi /etc/php-fpm.d/www.conf #编辑
user = nginx #修改用户为nginx
group = nginx #修改组为nginx

/etc/init.d/mysqld restart #重启MySql
/etc/init.d/nginx restart #重启nginx
/etc/rc.d/init.d/php-fpm restart #重启php-fpm
################################################################
测试篇
cd /usr/share/nginx/html/ #进入nginx默认网站根目录
vi index.php #新建index.php文件

<?php
phpinfo();
?>


:wq! #保存

chown nginx.nginx /usr/share/nginx/html/ -R #设置目录所有者

chmod 700 /usr/share/nginx/html/ -R #设置目录权限

在客户端浏览器输入服务器IP地址,可以看到相关的配置信息!
################################################################

备注

nginx默认站点目录是:/usr/share/nginx/html/

权限设置:chown nginx.nginx /usr/share/nginx/html/ -R

MySQL数据库目录是:/var/lib/mysql

权限设置:chown mysql.mysql -R /var/lib/mysql


参考文档:http://www.osyunwei.com/archives/2353.html

⑹ centos6 最完整安装php方法~呢

  1. 安装必要依赖。这一步较繁杂而且涉及更多linux方面的知识。我想偷懒因此用yum

    yum installlibxml2-devel

    yum installinstallopensslopenssl-devel

    yum installcurl-devellibjpeg-devellibpnglibpng-devel

    yum installfreetype-devellibmcrypt-devel

  2. php官网找一个php来下载,假设链接就是url

    cd (你的下载目录)

    wgeturl

    解压

    ./configure --prefix=(你的安装目录)

    cd (你的安装目录)

    make && make install && cd ..

  3. 增加环境变量

    vim /etc/profile

    export PATH=$PATH:(你的安装目录)bin/

    source /etc/profile

⑺ centos7 yum安装php7 怎么指定安装目录

用yum安装无法指定安装目录,只要在编译时,通过--prefix=path来指定bin的安装位置。

⑻ CentOS 7中PHP配置文件php.ini的放在哪个位置

这个要看你把php安装在哪个目录了。
如果是用yum这种云安装的,一般在/etc/php.ini

如果是自己编译安装的,那么在prefix参数设置的php安装目录下

阅读全文

与centosphp安装路径相关的资料

热点内容
unix网络编程卷4 浏览:805
找靓机app下单什么时候发货 浏览:411
android一个应用两个进程 浏览:801
linux硬盘复制 浏览:806
php图片服务器搭建 浏览:798
下载压缩文件怎么打开 浏览:192
新建文件夹叫什么名字 浏览:565
windows20的开机命令 浏览:332
微信一般在电脑的那个文件夹 浏览:509
go在win7下编译特别慢 浏览:256
光遇ios耳机安卓为什么没有 浏览:904
小米手机桌面文件夹经常自动散开 浏览:607
小米电话手表用什么app进行设置 浏览:265
虚拟打印机pdf下载 浏览:671
jdk编译运行方法 浏览:459
android执行shell命令 浏览:349
程序员头像女 浏览:57
有什么可以变头发颜色的app 浏览:935
玩具解压屋游戏下载 浏览:849
我的世界拔刀剑服务器地址id 浏览:891