Prepend-Append!

Rather than having to call / include a file you need on every single page, you can have them automatically prepended (top of file) or appended (bottom of file) automatically through your .htaccess file.

php_value auto_prepend_file "/real/path/to/file/functions.php"
php_value auto_append_file "/real/path/to/file/footer.php"

Permission denied

When I tried to run one of my php script, i threw this error.

Error:

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

Fatal error: Unknown: Failed opening required ‘/opt/lampp/htdocs/reroute/index.php’ (include_path=’.:/opt/lampp/lib/php’) in Unknown on line 0

Happened due to read/write access permission. Because Linux system maintains permission level very strictly. Therefore you need to change permission of that file/files. You can do it either graphically (like lazy as me! :p), see attached image below. Or go to the location via terminal and give the files proper read/write access for Owner, Group, and Other.

Right click on file --> properties --> permission tab --> change Access for all users.
Right click on file –> properties –> permission tab –> change Access for all users.

Using terminal

sudo chmod 775 /opt/lampp/htdocs/xyz

 

ubuntu command

XAMPP

First of all xampp folder is /opt/lampp so if you want to create some php files you put them in /opt/lampp/htdocs, you don’t go to var/www or var/www/html

Now to start the graphical interface

cd /opt/lampp
sudo ./manager-linux.run (or manager-linux-x64.run)

If you don’t care about the graphical interface and you just want to run xampp then you do

sudo /opt/lampp/lampp start

To make a shortcut, open a terminal and type

alias xampp='sudo /opt/lampp/manager-linux-x64.run'

and now every time you type xampp in terminal, the graphical interface will start