DS Log
In my blog, I delve into the world of programming web technologies, Linux, Unix-like, and graphic design using free tools on Linux.
KINGCODE
KingCode Editor (ex Texty Editor) is my project developed using Java Swing. Project is still in development and in beta version. I plan to add additional features focused for PYTHON, PHP, JAVA, C, JS and BASH.
Read more ↗
VUE on Linux
In this guide, I'll walk you through the step-by-step process of setting up Vue.js on your Linux system, empowering you to create dynamic and interactive web applications. Let's harness the power of Vue.js together on the Linux platform!
Read more ↗
Symfony PHP
Dive into the world of Symfony PHP with this comprehensive introduction. In this guide, you'll learn the essential steps to create and manage posts and users, empowering you to build dynamic web applications with ease.
Read more ↗
Trying Linux from Windows
How to set up a PHP development server on Ubuntu 22.04
Text editors
List of text editors for developers.
Read more ↗
Fonts
Important fonts everyone needs to know.
Read more ↗
Try Linux from Windows
Here are some quick videos I made showing how to try out Linux Mint on Windows.
Read more ↗
Tuesday, June 18, 2024
How to set up a PHP development server on Ubuntu 22.04
We have optimized the PHP/MariaDB server and, of course, require a read-write server configuration that allows editing files from our standard user account.
Although the PHP development server is useful, it is not entirely identical to the server where our project will be implemented. For example, issues may arise during the installation of a WordPress project. Specifically, issues may occur with HTTP requests, which could result in the server being stuck in an infinite loop.
Destination directory
For instance, we already have a /srv directory, so we will use it for our projects. We choose the public directory because some development frameworks recommend using the public directory for storing project files.
sudo mkdir /srv/webroot/
sudo mkdir /srv/webroot/public/
sudo mkdir /srv/phpmyadmin
sudo chgrp www-data /srv/webroot/public/
sudo chmod g+rwxs /srv/webroot/public/
sudo chgrp www-data /srv/webroot/
sudo chmod g+rwxs /srv/webroot/
sudo chgrp www-data /srv/phpmyadmin/
sudo chmod g+rwxs /srv/phpmyadmin/
Group
"www-data" is the group where Apache server data is stored. Therefore, let's add the user to that group to establish read and write access.
sudo usermod -a -G www-data korisnik
default.conf
Create backup of
“000-default.conf” file:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf.backup
...and in original file we add:
# /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
# DocumentRoot /home/korisnik/Servers/webroot/public
DocumentRoot /srv/webroot/public/
<Directory /srv/webroot/public>
Options Indexes FollowSymLinks
# AllowOverride None
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:8080>
ServerAdmin webmaster@localhost
DocumentRoot /srv/phpmyadmin
<Directory /srv/phpmyadmin>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Then add 8080 to
‘/etc/apache2/ports.conf’ file:
Listen 8080
Reboot
Restart you machine after doing all of this!
Logs
We will use
Glogg application to read logs.
sudo apt-get install glogg
You can find logs in directory:
/var/log/apache2/
We will need to add user to
adm group (only on
Debian systems):
Additional: Can't edit files from PHP
Open file:
sudo nano /etc/apache2/envvars
Add yourself as user:
# export APACHE_RUN_USER=www-data
export APACHE_RUN_USER=your_username
And finally, we restart service:
sudo systemctl restart apache2
Labels: linux, php