企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# php-nginx-mysql联动 [TOC] ## 一、nginx+php **nginx配置文件中增加以下内容** ```sh cat /app/nginx/conf/conf.d/www.conf server { listen 80; server_name www.etiantian.omg; location / { root html/www; index index.html index.htm; } location ~ .*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } } ``` 创建phpinfo ```sh echo "<?php phpinfo(); ?>" >/data/html/www/test_info.php ``` 重启nginx ```sh nginx -t nginx -s reload ``` 访问`www.etiantian.omg/test_info.php`,显示php配置信息则表示nginx与php联通 ## 二、php+mysql 创建mysql测试页面 ```sh cat /application/nginx/html/blog/test_mysql.php <?php $link_id=mysql_connect('localhost','root','noah123') or myssql_error(); if($link_id){ echo "mysql successful by noah !!!"; }else{ echo mysql_error(); } ?> ``` 访问`blog.etiantian.omg/test_mysql.php`,显示自定义的成功提示信息则表示php与mysql联通