Home  >  Article  >  Backend Development  >  OneinStack detailed tutorial for installing PHP

OneinStack detailed tutorial for installing PHP

王林
王林Original
2024-03-10 17:48:04948browse

OneinStack detailed tutorial for installing PHP

OneinStack is a one-click installation program that integrates Nginx, Apache, MySQL, PHP, Redis and other software, aiming to simplify the deployment and management of Web environments on Linux servers. This article will provide a detailed tutorial on the OneinStack PHP installation process and provide specific code examples to help readers better understand and operate.

1. Preparation

Before you start installing OneinStack, you need to ensure that the server meets the following conditions:

  1. The operating system is CentOS/Debian/Ubuntu.
  2. Have root user permissions.
  3. At least 2GB RAM and 10GB hard drive space.

2. Download OneinStack

  1. Log in to SSH and use the wget command to download the OneinStack script:

    wget http://mirrors.linuxeye.com/oneinstack-full.tar.gz
  2. Unzip OneinStack:

    tar xzf oneinstack-full.tar.gz
    cd oneinstack

3. Install PHP

  1. Run the OneinStack script and select the software you want to install, select here Install PHP:

    ./install.sh
  2. Select the PHP version and other related configurations, and follow the prompts.
  3. After PHP is installed, you can modify the PHP configuration file according to your needs, for example, modify the php.ini file:

    vi /usr/local/php/etc/php.ini
  4. Restart the PHP service to make the configuration take effect:

    /etc/init.d/php-fpm restart

4. Verify PHP installation

  1. Create info.php# in the root directory of the website ## File:

    vi /home/wwwroot/default/info.php

  2. Edit

    info.php, enter the following:

    <?php
    phpinfo();
    ?>

  3. Save and exit, visit
  4. http://your_domain/info.php, check the details of PHP to confirm that PHP is installed successfully.
5. Commonly used PHP extension installation

In addition to basic PHP installation, you may also need to install some commonly used PHP extensions. The following are some common PHP extension installation examples:

# 安装PHP GD扩展
./addons.sh install php-gd

# 安装PHP Redis扩展
./addons.sh install php-redis

# 安装PHP Memcached扩展
./addons.sh install php-memcached

Conclusion

Through the above steps, we introduced the process of installing PHP under OneinStack in detail and provided some specific code examples. I hope this article will be helpful to you and enable you to set up and manage the Web environment on the server more smoothly. If you encounter any problems during the installation process, you can consult the OneinStack official documentation or seek technical support. I wish you all the best!

The above is the detailed content of OneinStack detailed tutorial for installing PHP. 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