search
HomeBackend DevelopmentPHP ProblemHow to deploy php project on linux

How to deploy php project on linux

Nov 02, 2020 pm 02:30 PM
linuxphp project

How to deploy PHP projects in Linux: First open the terminal and install PHP common extensions; then restart apache to make PHP take effect [apachectl restart]; finally test the PHP environment.

How to deploy php project on linux

How to deploy PHP projects in Linux:

1. First open the terminal.

yum install php php-devel

Enter to confirm the installation, wait about 20 seconds and the installation is successful.

How to deploy php project on linux

2. Install common PHP extensions (optional, based on your actual needs)

yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

How to deploy php project on linux

##3 , Restart apache to make php take effect

apachectl restart

How to deploy php project on linux

4. Test the php environment

Create a new info in the /var/www/html directory (Apache default root directory) .php

vi /var/www/html/info.php

File content

<?php phpinfo(); ?>

Visit http://localhost/info.php

How to deploy php project on linux

5. Additional: mysql test ( It has not been installed and needs to be installed)

Create a new mysql.php in the /var/www/html directory (apache default root directory)

vi /var/www/htmml/mysql.php

File content

<?php$con = mysql_connect("localhost","root","root");if (!$con)  {  die(&#39;Could not connect: &#39; . mysql_error());  } mysql_select_db("mysql", $con); $result = mysql_query("SELECT * FROM user"); while($row = mysql_fetch_array($result))  {  echo $row[&#39;User&#39;] . " " . $row[&#39;Host&#39;];  echo "<br />";  } mysql_close($con);?>

How to deploy php project on linux

6. Visit http://localhost/mysql.php to view database information.

How to deploy php project on linux

Related video recommendations:

PHP programming from entry to proficiency

The above is the detailed content of How to deploy php project on linux. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft