Centos部署PHP

环境:Centos7

安装PHP步骤:

一:安装依赖

yum install epel-release -y

yum install gcc openssl-devel libxml2-devel bzip2-devel libmcrypt-devel sqlite-devel oniguruma-devel -y

二:下载php源码⽂件

 cd /usr/local/src

 wget https://www.php.net/distributions/php-7.4.11.tar.xz

三:编译安装php

tar xf php-7.4.11.tar.xz

cd php-7.4.11

./configure --prefix=/usr/local/php74 -enable-mysqlnd--with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --with-zlib --with-config-file-path=/etc/php74 --with-config-file-scan-dir=/etc/php.d --enable-mbstring --enable-xml --enable-sockets -enable-fpm --enable-maintainer-zts --disable-fileinfo

make && make install

四:⽣成配置⽂件

cp /usr/local/src/php-7.4.11/php.ini-production

/etc/php.ini

cd /usr/local/php74/etc/
 
cp php-fpm.conf.default php-fpm.conf

cd php-fpm.d/

cp www.conf.default www.conf

grep '^[^;]' www.conf
[www]
user = nginx
group = nginx
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

五:创建访问⽇志路径

mkdir -p /usr/local/php74/log

六: 启动并验证php

 /usr/local/php74/sbin/php-fpm -t
[24-Feb-2023 21:16:06] NOTICE: configuration file /usr/local/php74/etc/php-fpm.conf
test is successful

 cp -a /usr/local/src/php-7.4.11/sapi/fpm/php-
fpm.service /usr/lib/systemd/system/

 systemctl daemon-reload

 systemctl enable --now php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to
/usr/lib/systemd/system/php-fpm.service.

 ss -lntp|grep 9000
LISTEN   0    128   127.0.0.1:9000           *:*         
users:(("php-fpm",pid=124723,fd=8),("php-fpm",pid=124722,fd=8),("php-
fpm",pid=124721,fd=6))

七:配置nginx⽀持fastcgi

vim /usr/local/nginx/conf/nginx.conf
#user nobody;
worker_processes  1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid    logs/nginx.pid;
events {
 worker_connections  1024;
}
http {
 include    mime.types;
 default_type application/octet-stream;
 sendfile    on;
 keepalive_timeout  65;
 server {
   listen    80;
   server_name localhost;
   location / {
     root  /data/wordpress;  #指定wordpress⽬录
     index index.php index.html index.htm;  #指定默认主⻚
   }
   error_page  500 502 503 504 /50x.html;
   location = /50x.html {
     root  html;
   }
   
   location ~ \.php$ {  #实现php-fpm
     root      /data/wordpress;
     fastcgi_pass  127.0.0.1:9000;
     fastcgi_index index.php;
     fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
     include    fastcgi_params;
   }
 }
}

cd /usr/local/nginx/sbin/

 ./nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

systemctl restart nginx

八:测试php

mkdir -p /data/wordpress

cd /data/wordpress/

 vim test.php
<?php
phpinfo();
?>

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
the images x_gen = model.decoder(input_var).data.cpu() vutils.save_image(x_gen, 'samples/vaegan.png', normalize=True, nrow=8) ``` 最后,我们需要定义一些超参数,读取数据集,以及首先,在CentOS系统上安装Apache、PHP和MySQL等必要的组件。可以使用以下命令: 1.调用训练和测试函数: ```python # Define the hyperparameters batch_size = 128 image_size = 64 安装 Apache sudo yum install httpd 2.安装 PHP sudo yum install php 3.安装 MySQL sudo yumndf = 64 z_size = 100 input_channel = 3 output_channel = 3 num_epochs = 100 install mysql-server 然后,将您的PHP项目放置在Apache的默认网站目录/var/www/html中。您可以 learning_rate = 0.0002 beta1 = 0.5 cuda = True # Create the dataloader 通过FTP或SCP等工具将项目文件上传到服务器上。 接下来,您需要将Apache配置文件中的DocumentRoottransform = transforms.Compose([ transforms.Resize(image_size), transforms.CenterCrop(image_size), transforms.ToTensor(), transforms.Normalize((0设置为您的项目目录。打开/etc/httpd/conf/httpd.conf文件并找到以下行: DocumentRoot "/var/www/html" 将其更改为您的项目目录,例如: DocumentRoot "/var/www/html/myproject" 然后,重启.5, 0.5, 0.5), (0.5, 0.5, 0.5)), ]) dataset = datasets.ImageFolder(root='data', transform=transform) dataloader = torch.utils.data.DataLoader(dataset, batch_size=batch_size,Apache服务器以使更改生效: sudo systemctl restart httpd 最后,您可能需要配置MySQL以允许远程连接 shuffle=True, num_workers=4) # Train the model train(ndf, z_size, input_channel, output_channel, dataloader,如果您需要从其他位置访问数据库。这可以通过编辑/etc/my.cnf文件并将bind-address设置为0.0.0.0来完成。然后,重启MySQL服务器以使更改生效: sudo systemctl restart mysqld 完成, num_epochs, learning_rate, beta1, cuda) # Test the model test(ndf, z_size, input_channel, output_channel以上步骤后,您的PHP项目应该已经成功部署CentOS系统上。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值