Delete old tmp file when Apache starts - apache

I'm using Bitnami MAMP Stack on OSX and would like to clear the tmp directory whenever I start the Apache Web Server.
So basically I need to know where to add the following command, or a script containing the command rm -rf ~/Library/Containers/com.bitnami.mampstack/Data/app/php/tmp.
Takk,
Robert.

Just look inside your MAMP program folder. There is ./bin/start.sh
Just add you line to this.
Or to startApache.sh if you want to execute only with Apache restarts.

Related

Create local debian repository

My goal is to demonstrate creating a local debian repository with controlled versions of tools used (e.g. compiler versions) to make a build system more predictable.
I've tried to follow this example: http://linuxconfig.org/easy-way-to-create-a-debian-package-and-local-package-repository
but when I get to the apt-get update stage, I always get a 404 not found on the repository I've added.
The apache2 server is running, I can view the default page installed at http://localhost/html/index.html.
I am trying this with the file fortune-mod_1%3a1.99.1-7_amd64.deb installed to /var/www/debs. I create the Packages.gz file as the tutorial suggests:
dpkg-scanpackages debs /dev/null | gzip -9c > debs/Packages.gz
I also add a new file: /etc/apt/sources.list.d/myppa.list with this line:
deb http://localhost debs/
I restart the apache2 service just in case:
sudo service apache2 restart
but running:
sudo apt-get update
still produces this error:
W: Failed to fetch http://localhost/debs/Packages 404 Not Found
Is there something basic I'm missing? Ultimately, I'd like to get this working over a LAN, but first have to get it working on a single machine.
EDIT: I'm doing this on Ubuntu 14.04.
EDIT: Show contents of file /etc/apt/sources.list.d/myppa.list
tldr; use aptly
It's the easiest apt repository management tool I've found and it comes with neat tutorial showing how to create, populate, and publish your own apt repository.
References:
https://www.aptly.info/
https://www.aptly.info/tutorial/repo/
I ended up solving the problem. It was an issue with the default document root being different for the tutorial than on my system. All I did was move my debs folder to html (document root turns out to be /var/www/html, not just /var/www on my install). That did the trick.

#1 - Can't create/write to file '/var/folders/

I get the following error(see. figure) in my Xampp and can not access mySQL through XAMPP and phpMyAdmin. In this link-1 and link-2 possible solution is given; but none of them woks in Mac OS 10.9
I assume the problem is with configuration file my.cnf which is located in the /Applications/XAMPP/xamppfiles/etc/my.cnf.
Any suggestion will be appreciate. Thanks.
Completely stop XAMPP, this means stop apache, ftp and mysql.
Open the program called Terminal.
Type in sudo -i to become root (or do su root if the first doesn’t work for you).
You are most probably asked for a password which you have to enter while no characters are displayed.
Execute chmod 600 /Applications/XAMPP/xamppfiles/etc/my.cnf .
Exit your root shell with exit or just close Terminal.
Restart XAMPP (apache, ftp and mysql).
From: http://slopjong.de/2009/08/31/houston-i-cant-write-to-file/
Solution
Reinstall Xampp. Before reinstalling delete all the files, take away your htdoc and database folder to other place of your hdd.
The database location in Mac OS-10.9 is
cd '/Applications/XAMPP/xamppfiles/var/mysql/'
Htdoc location
cd '/Applications/XAMPP/xamppfiles/htdocs/'
When you complete reinstallation put all the folders to corresponding location and your database will be automatically update.
I looked some other solution but none of them seems work. I was scare if I remove the database to other location and import later will it work or not. And luckily it works, but as precaution careful when you remove big database.

Cannot set-up MyPHPadmin in Apache

I just started using Apache, but when I try to run myPHPadmin, I get this error message:
1 - Can't create/write to file '/var/folders/w1/5yx2p9mj7w9bm67gdwhqxwsr0000gn/T/#sql1ba_3_0.MYI' (Errcode: 13)
Another post in the Stack Overflow suggested changing the permissions on the XAMPP file, my.cnf, with this command:
sudo chmod 600 my.cnf
I tried running the code in Mac Terminal, but the result was "No such file or directory."
Does anyone know what I should try next?
This is a permission problem on your datadir (where MySQL wants to write files). Normally, at MySQL installation, correct permissions are set for the user who runs mysqld.
Are you sure that MySQL was installed correctly as part of XAMPP installation?

what happen if i delete apache log file?

I have 4 files in /var/log/apache2 and I just deleted 2 of them (I do have backups). would it affect apache's logging capabilities? does apache automatically create files and write to them if they don't exist?
It will create new file automatically.
The file is deleted but the file handle remains until you reload/restart apache, at least on Rhel 7.
You can verify this by running sudo lsof | grep access_log after deleting /var/log/httpd/access_log.
You might see the file automatically getting recreated some time later when logrotate runs, as that issues a reload which would then trigger the file to be created again.

is there a command in centos to dynamically add entries to the inittab file?

is there a command in centos to dynamically add entries to the inittab file ? I am writing a new daemon and would like the init to restart it when it dies for any reason.
Can you add the entry with echo, or whatever, then use initctl as necessary?