centos7.7如何安装php7.3的lnmp环境和composer

发布时间:2025-02-20 点击:45
下面由composer教程栏目给大家介绍centos7.7安装php7.3的lnmp环境和composer详细步骤,希望对需要的朋友有所帮助!
1.更新源
yum update
2.安装nginx
yum install nginx
3.启动nginx
service nginx start
4.访问http://你的ip
如果想配置域名,见最下面。
5.安装mysql:
安装mysql源 yum localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
安装: yum install mysql mysql-server
启动: /etc/init.d/mysqld start 或者 service mysqld restart
重置密码:mysql -u root -p
几率报错 can't connect to local mysql server through socket '/var/lib/mysql/mysql.sock' (2)
原因:权限问题
解决: sudo chown -r root:root /var/lib/mysql (两个root都可以改为拥有者,但是需要保持一致)
重启服务
service mysqld restart
登陆mysql
mysql -u root -p //按回车直接可以登陆,刚安装完mysql是没有密码的
修改mysql密码
use mysql;
低版本修改:update user set password=password('你的密码') where user='root';
高版本修改:update user set authentication_string = password('你的密码'), password_expired = 'n', password_last_changed = now() where user = 'root';
alter user 'root'@'localhost' identified by '你的密码';
如果说密码强度不够,可以查看密码级别:show variables like "%password%";
然后设置为低级别:set global validate_password_policy=0;
最后退出;
exit;
重启 service mysqld restart
允许远程访问
1.必要时加入以下命令行,为root添加远程连接的能力。链接密码为'你的密码'
grant all privileges on *.* to 'root'@'%' identified by '你的密码' with grant option;
flush privileges;
2.打开my.cnf文件
添加一行 bind-address=0.0.0.0
3.重启mysql
6.安装php
yum install php php-devel //php5.6版本
如果想安装7.3
首先安装 epel 源
1.yum install epel-release //安装 epel 源2.yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm //安装 remi 源3.yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xml 4.php的安装目录/etc/opt/remi/php73/ php.ini也在里面
找到php.ini 里面fix_pathinfo 修改成0 但是不能看phpinfo();
操作
systemctl restart php73-php-fpm #重启systemctl start php73-php-fpm #启动systemctl stop php73-php-fpm #关闭systemctl status php73-php-fpm #检查状态7.最后在yum update 更新php资源 方便以后更新扩展用
8.安装composer
curl -ss https://getcomposer.org/installer | php73
mv composer.phar /usr/local/bin/composer
这样输入composer会报错 :/usr/bin/env: php: no such file or directory
解决方法
cd usr/bin
cp php73 php
在输入composer就好了
更改镜像为阿里云:composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
9.安装git
yum -y install git
10.下载laravel框架
composer create-project --prefer-dist laravel/laravel 项目名称 "6.*"
composer create-project --prefer-dist laravel/laravel laravelxs "6.*"修改composer文件。
 cd /root/.config/composer/vi auth.json{"bitbucket-oauth": {},"github-oauth": {},"gitlab-oauth": {},"gitlab-token": {"github.com": "在git上生成的token"},"http-basic": {},"bearer": {}} 添加
"github.com": "在git上生成的token"
11.nginx域名的配置
创建文件:域名.conf
里面的内容:
server{listen 80;server_name 你的域名;access_log /var/log/nginx/access.log;error_log /var/log/nginx/error.log;index index.html index.htm index.php;root 你的项目目录;location / {try_files $uri $uri/ /index.php$is_args$args;}location ~ .*\\\\.(php|php5)?${#fastcgi_pass unix:/dev/shm/php-cgi.sock;fastcgi_pass 127.0.0.1:9000;fastcgi_connect_timeout 180;fastcgi_read_timeout 600;fastcgi_send_timeout 600;fastcgi_index index.php;fastcgi_split_path_info ^((?u). \\\\.php)(/?. )$;fastcgi_param script_filename $document_root$fastcgi_script_name;fastcgi_param path_info $fastcgi_path_info;fastcgi_param path_translated $document_root$fastcgi_path_info;include fastcgi_params;}location ~ .*\\\\.(gif|jpg|jpe

租云服务器搭建网站
云服务器架设的网站
国内云服务器出租
妙用nofollow标签优化 关键词排名瞬间起飞
域名访问无效-域名及账户问题
服务器上网站打不开了提示
买云服务器怎么配置
【12.14域名商机】谷歌为无人机业务收购Wing.com;十点读书启用10dian.com;本周海外的10个终端域名销售;