当前位置:首页 » 编程软件 » 编译安装php参数

编译安装php参数

发布时间: 2022-08-12 10:30:58

Ⅰ 阿里云默认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

linux服务器php编译安装成功之后,无法重新编译安装,怎么办

具体看你缺少什么参数,一般的参数都可以通过配置文件修改的,文件路径一般再/etc/php.ini ,如果是是缺少依赖lib的话,可以单独编译库源码 成.so文件,添加依赖文件到 php.ini 重启就好了

Ⅲ editplus配置php环境那个参数怎么设置

1.打开editplus

2.点击菜单栏“工具”
3.选择下拉菜单的“配置用户工具”,进入配置页面。

1.点击"添加工具"

2.选择"应用程序"

在下面的输入框中输入

菜单文字:php
命令:<你本机php安装目录>\php.exe (例:D:\Program Files\PHP\php.exe)

参数:$(FilePath)
初始目录 :$(FileDir)

动作选”捕捉输出“

完成上述步骤后在d盘新建一个文件 hello.php

输入代码

<?php
echo "Hello,World!";
?>

1.点击"工具"---"php" ,我自己配置的快捷键是ctrl + 2,你也可以自由设置。

2.在下方输出框查看运行结果,显示hello,world

到此,整个php 编译环境配置完毕。

Ⅳ 编译PHP要用什么样的参数,才能支持远程连接Mysql服务器

和PHP没关系,要设置MYSQL
用root用户进数据库,选择mysql库,user表里,把对应用户(比如root)的Host改为%号(任意IP,不分本地远程),或者改为某一IP(指定IP登录),再重启下MYSQL,就可以远程访问MYSQL了。

Ⅳ 如何编译安装PHP扩展

一开始安装PHP的时候,我们并不知道需要哪些扩展,所以只有等到我们真正用到的时候才想办法去安装。
安装PHP扩展最简单的办法就是
sudo apt-get install php5-xxx

但有的时候并非我们所愿,源里面并没有我们需要的扩展,这时候就需要我们下载源码自己编译安装了。
这篇文章中我将介绍在本地Linux平台下编译安装PHP扩展的方法。
现在网站根目录下创建 index.php 打印基本的配置信息,以验证我们是否安装成功。
配置编译环境
我们需要安装一些编译必须的库,还有 php-dev 版本
Ubuntu
sudo apt-get install php5-dev php5-mysql gcc libpcre3-dev

Fedora
sudo yum install php-devel php-mysqlnd gcc libtool

RHEL
sudo yum install php-devel php-mysql gcc libtool

Suse
yast2 -i php5-pear php5-devel php5-mysql gcc

安装扩展
PHP有两种可供安装的扩展:一种是PHP原生的但是默认没有安装的,另一种的第三方开发的扩展。
下面依次介绍两种扩展的安装方法:
安装之前我们需要一份和当前机器上相同版本的PHP源码
cd code
wget http://cn2.php.net/distributions/php-5.5.9.tar.bz2
tar xvjf php-5.5.9.tar.bz2
cd php-5.5.9

前往此处 下载相应的源码包。
在 /ext 目录下面可以看到所有PHP原生的扩展。
安装原生扩展
以 PHP-intl 为例,这是PHP国际化的扩展。
为了安装这个扩展我们需要先安装ICU 库
sudo apt-get install icu-devtools icu-doc libicu-dev libicu52 libicu52-dbg

ICU 安装成功之后进入/ext/intl 目录:
cd intl
phpize
./configure --enable-intl
make
sudo make install

下面解释一下上面的每个命令:
phpize : 是用来扩展php扩展模块的,通过phpize可以建立php的外挂模块
./configure --enable-intl: 配置编译环境,相当于告诉编译器编译PHP源码的时候加上intl这个扩展。
make: 将会把源码编译成 intl.so
make install : 将会把 intl.so 移动到当前安装的 PHP 的扩展目录。
接下来我们要做的就是在php.ini中启用这个扩展,这一步将会在最后给出示例。
安装第三方扩展
将以这个 扩展为例,这个扩展主要实现了PHP识别条形码的功能。
先安装必要的依赖
sudo apt-get install pkg-config

git clone https://github.com/mongodb/mongo-php-driver
cd mongo-php-driver
phpize
./configure
make
sudo make install

将会生成一个文件,将其拷贝到PHP的扩展目录下面。
启用扩展
在php.ini中启用扩展的方式有很多:
直接在php.ini文件中添加 extension=mongo.so,这是最简单直接的方法。
也可以单独建一个ini文件,然后在php.ini中包含这些文件就可以了。
下面介绍一下第二种方法:
cd `/etc/php5/mods-available`

这个目录里可以放新建的ini文件,然后执行
sudo touch mongo.ini
echo "extension=mongo.so" | sudo tee -a mongo.ini
sudo touch intl.ini
echo "extension=intl.so" | sudo tee -a intl.ini

上面的命令将会创建ini文件,并且写如相应的配置信息。
然后执行下面的命令启用扩展即可(需要安装 php5enmod 工具):
sudo php5enmod mongo
sudo php5enmod intl

如果未安装 php5enmod 工具,则需要手动配置:
ln -s /etc/php5/mods-available/mongo.ini /etc/php5/cli/conf.d/mongo.ini
ln -s /etc/php5/mods-available/intl.ini /etc/php5/cli/conf.d/intl.ini
ln -s /etc/php5/mods-available/mongo.ini /etc/php5/fpm/conf.d/mongo.ini
ln -s /etc/php5/mods-available/intl.ini /etc/php5/fpm/conf.d/intl.ini

最后在执行一下重启操作就可以了:
sudo service nginx restart
sudo service php5-fpm restart

Ⅵ 编译安装php时怎么使用源码安装的参数

1、Linux下,默认是在/usr/local/bin/,假如你设置--prefix=/usr/local/php那么就在/usr/local/php/bin/ 2、sbin道理相同。sbin的意思就是server bin 3、EPREFIX没用过 4、如果要用2套版本,用prefix区分开不同的安装目录。

Ⅶ 哪些是编译php时的常用configure参数

分版本的,不同版本有一点点区别。大部分都是一样的。
比如PHP7.1.5可以参考以下:
./configure --prefix=/ueidc/php715 --with-config-file-path=/ueidc/php715/ --with-config-file-scan-dir=/ueidc/php715/etc --with-openssl=/ueidc/openssl110f --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mysqlnd --enable-sockets --enable-mbstring --enable-fpm --enable-soap --enable-gd-native-ttf --enable-opcache=no --with-gettext --with-png-dir=/ueidc/libpng162 --with-jpeg-dir=/ueidc/jpeg9 --with-zlib-dir=/ueidc/zlib128 --with-libxml-dir=/ueidc/libxml228 --with-mhash=/ueidc/mhash099 --with-curl=/ueidc/curl7531 --with-gd=/ueidc/gd210 --with-mcrypt=/ueidc/libmcrypt257 --with-freetype-dir=/ueidc/freetype254 -with-iconv-dir=/ueidc/libiconv115

Ⅷ 编译安装php,怎么生成apxs

让Apache服务器能够支持PHP。 如果编译安装时不加--options --with -apxs2参数,即使你的电脑上安装了Apache和PHP,通过Apache是不能访问PHP页面的,因为Apache本身只支持静态html页面。加入此参数,则能通过Apache访问PHP页面了。

热点内容
java电话簿 发布:2025-02-07 19:49:26 浏览:795
超级脚本制作 发布:2025-02-07 19:31:30 浏览:486
怎么查看支付宝的账号密码 发布:2025-02-07 19:26:48 浏览:16
惠普服务器查看ip指令 发布:2025-02-07 19:26:47 浏览:434
算法设计模式 发布:2025-02-07 19:15:52 浏览:745
服务器1u能连接几台电脑 发布:2025-02-07 18:50:02 浏览:153
立人编译 发布:2025-02-07 18:48:32 浏览:765
日产途达四驱的有哪些配置 发布:2025-02-07 18:42:02 浏览:832
服务器搭建镜像站 发布:2025-02-07 18:41:55 浏览:377
游戏上云成标配云服务器该怎么选 发布:2025-02-07 18:26:13 浏览:141