Fedora - PHP Development on Fedora with Eclipse - Printable Version +- Sick Gaming (https://www.sickgaming.net) +-- Forum: Computers (https://www.sickgaming.net/forum-86.html) +--- Forum: Linux, FreeBSD, and Unix types (https://www.sickgaming.net/forum-88.html) +--- Thread: Fedora - PHP Development on Fedora with Eclipse (/thread-93609.html) |
Fedora - PHP Development on Fedora with Eclipse - xSicKxBot - 02-15-2020 PHP Development on Fedora with Eclipse <div style="margin: 5px 5% 10px 5%;"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/php-development-on-fedora-with-eclipse.png" width="802" height="842" title="" alt="" /></div><div><p><a href="https://projects.eclipse.org/projects/eclipse">Eclipse</a> is a full-featured free and open source IDE developed by the Eclipse Foundation. It has been around since 2001. You can write anything from C/C++ and Java to PHP, Python, HTML, JavaScript, Kotlin, and more in this IDE. </p> <p> <span id="more-30437"></span> </p> <h2>Installation</h2> <p>The software is available from Fedora’s official repository. To install it, invoke: </p> <pre class="wp-block-preformatted">sudo dnf install eclipse</pre> <p>This will install the base IDE and Eclipse platform, which enables you to develop Java applications. In order to add PHP development support to the IDE, run this command: </p> <pre class="wp-block-preformatted">sudo dnf install eclipse-pdt</pre> <p>This will install PHP development tools like PHP project wizard, PHP server configurations, composer support, etc. </p> <h2>Features</h2> <p>This IDE has many features that make PHP development easier. For example, it has a comprehensive project wizard (where you can configure many options for your new projects). It also has built-in features like composer support, debugging support, a browser,a terminal, and more. </p> <h2>Sample project</h2> <p>Now that the IDE is installed, let’s create a simple PHP project. Go to <em>File →New → Project</em>. From the resulting dialog, select <em>PHP project</em>. Enter a name for your project. There are some other options you might want to change, like changing the project’s default location, enabling JavaScript, and changing PHP version. See the following screenshot. </p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/php-development-on-fedora-with-eclipse.png" alt="" class="wp-image-30438" /><figcaption>Create A New PHP Project in Eclipse</figcaption></figure> <p>You can click the <em>Finish</em> button to create the project or press <em>Next</em> to configure other options like adding include and build paths. You don’t need to change those in most cases. </p> <p>Once the project is created, right click on the project folder and select <em>New → PHP File</em> to add a new PHP file to the project. For this tutorial I named it <em>index.php</em>, the conventionally-recognized default file in every PHP project. </p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/php-development-on-fedora-with-eclipse-1.png" alt="" class="wp-image-30440" /></figure> <p>Then add the your code to the new file. </p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/php-development-on-fedora-with-eclipse-2.png" alt="" class="wp-image-30441" /><figcaption>Demo PHP code</figcaption></figure> <p>In the example above, I used CSS, JavaScript, and PHP tags on the same page mainly to show that the IDE is capable of supporting all of them together. </p> <p>Once your page is ready, you can see the result output by moving the file to your web server document root or by creating a development PHP server in the project directory. </p> <p>Thanks to the built-in terminal in Eclipse, we can launch a PHP development server right from within the IDE. Simply click the terminal icon on the toolbar (<img class="wp-image-30444" style="width: 21px" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/php-development-on-fedora-with-eclipse-3.png" alt="Terminal Icon" />) and click <em>OK</em>. In the new terminal, change to the project directory and run the following command:</p> <pre class="wp-block-preformatted">php -S localhost:8080 -t . index.php </pre> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/php-development-on-fedora-with-eclipse-4.png" alt="" class="wp-image-30446" /><figcaption>Terminal output</figcaption></figure> <p>Now, open a browser and head over to http://localhost:8080. If everything has been done correctly per instructions and your code is error-free, you will see the output of your PHP script in the browser.</p> <figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/02/php-development-on-fedora-with-eclipse-5.png" alt="" class="wp-image-30442" /><figcaption>PHP output in Fedora</figcaption></figure> </div> https://www.sickgaming.net/blog/2020/02/14/php-development-on-fedora-with-eclipse/ |