PHP is the most popular, open-source scripting language that is popular for web development. In this tutorial, we will show you how to install PHP on your openSUSE system, as well as some additional modules to enhance its functionality. Before we begin, make sure you have root access or sudo privileges on your system.
Prerequisites
- A running openSUSE system
- Root access or sudo privileges
Update Your System
Before installing any new software, it is always a good idea to update your system. You can do this by running the following command:
sudo zypper update
How to Install PHP on openSUSE
To install PHP, simply run the following command:
sudo zypper install php
After the installation is complete, you can verify the PHP version by running:
php -v
Install Additional PHP Modules
To enhance the functionality of your PHP installation, you may want to install additional modules. Some common modules include:
- php-gd: For image manipulation
- php-mysql: For MySQL database support
- php-xml: For XML parsing and manipulation
- php-mbstring: For multi-byte string handling
You can install these modules using the following command:
sudo zypper install php-gd php-mysql php-xml php-mbstring
Configure PHP (Optional)
If you want to customize your PHP settings, you can edit the php.ini
file, which is located in the /etc/php
directory. To open the file with a text editor, such as Vim or Nano, run:
sudo nano /etc/php/php.ini
Make any desired changes to the settings, then save and exit the file.
Install a Web Server (Optional)
PHP is commonly used with web servers such as Apache or Nginx. If you do not already have a web server installed, you can follow the linked guides to set one up.
Test Your PHP Installation
To test your PHP installation, create a new file named info.php
in your web server’s document root directory (usually /var/www/html
for Apache, or /usr/share/nginx/html
for Nginx) with the following content:
<?php
phpinfo();
?>
Now, open a web browser and navigate to http://your_server_ip/info.php
. You should see a page displaying information about your PHP installation. If everything is working as expected, you have successfully installed PHP on your openSUSE system.
Conclusion
You have now installed PHP on your openSUSE system and are ready to start developing web applications. Be sure to explore other useful software for your server, such as installing a database server like MariaDB or MySQL, and setting up a development environment with Python. Additionally, consider configuring your system for increased security