en en en en hu en en en en en en en en en en en en en en en en en ja en hu en en en en en en en en en en en en en en en en en ru en en en en en en en fr en en en en en fr en ja en en en en en en az en en en en en en en en en en en en en en en sv et de en en en en fr en en en en en en en en en az en en en en en en en en en en en en en en en sv et de en en en en fr en en en en en en en en en az en en en en en en en en en en pt en en en en en en en
If you pass a video to avconv, it returns meta-data about the video, including its duration, e.g.
A search on the Ubuntu forums returned an easy way to parse the above output using Linux scripting1.
Once, I had the above data (e.g.  “00:00:03.76”) in a string, I needed to convert it to an integer value. Further research returned the following snippet of PHP code
list($hours,$mins,$secs) = explode(':',$duration); $seconds = mktime($hours,$mins,$secs) - mktime(0,0,0);
The first mktime returned a timestamp relative to the current time, so we need to subtract the number of seconds from the current timestamp at midnight. This gives us the number of seconds in our video as an integer value.
Raguet Roman, 2012, accessed  21 April 2014,  .
2012, Stack Overflow, accessed  21 April 2014, .
Recently, I went to install the Laravel PHP framework on a fresh virtual machine. Here are the steps that I went through.
First of all, I created a directory for my project and made this my current directory.
$ mkdir myproject $ cd myproject
I decided to use Composer to install Laravel. In order to install Composer I needed to use curl. So, I needed to install curl.
$ sudo apt-get install curl $ curl -sS https://getcomposer.org/installer | php
If you want to execute composer directly, so instead of typing…
You can do the following…
$ sudo chmod +x composer.phar $ composer.phar
If you want composer to be globally accessible from any folder on your Linux environment, then use the following…
$ mv composer.phar /usr/local/bin/composer
Next, I went to install Laravel. Here, I got an error saying “Mcrypt PHP extension required”. This was resolved as follows.
$ sudo apt-get install php5-mcrypt
Then, I tested mcrypt as follows.
$ php --ri mcrypt Extension 'mcrypt' not present.
So, I needed to more than just install mcrypt. This was resolved as follows.
$ sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available $ sudo php5enmod mcrypt $ sudo service apache2 restart
Now, I could test as below.
$ php --ri mcrypt mcrypt mcrypt support => enabled mcrypt_filter support => enabled Version => 2.5.8 Api No => 20021217 Supported ciphers => cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes Supported modes => cbc cfb ctr ecb ncfb nofb ofb stream Directive => Local Value => Master Value mcrypt.algorithms_dir => no value => no value mcrypt.modes_dir => no value => no value
Finally, I was ready to install Laravel using Composer. In the following command, I use the folder name “back-end” to store my Larvel files.
$ php composer.phar create-project laravel/laravel back-end –-prefer-dist
There is a note on the Laravel documentation that Laravel needs to configure folders within app/storage with write access by the web server. I achieved this as follows.
$ cd back-end/app $ sudo chown -R www-data:www-data storage
Next, I wanted to set to Apache virtual hosting to point to my Laravel public folder. As in a previous blog entry, I copied my /etc/apache2/sites-available/000-default.conf to mysite.conf.
$ cd /etc/apache2/sites-available/ $ cp 000-default.conf mysite.conf
In mysite.conf, I updated the DocumentRoot directive to point to my local repository. The extract from mysite.conf is as follows. The public folder is Laravel’s public folder.
... DocumentRoot "/home/myuser/myproject/back-end/public/"   Options Indexes FollowSymLinks MultiViews # changed from None to All AllowOverride All Require all granted   ...
Note the line “Require all granted”. This command has been updated from my earlier blog post and is required by Apache 2.4. One of my previous blog entries listed the following lines instead. These are now out of date.
Order allow,deny Allow from all
Once mysite.conf was updated, I used the following commands to activate the new virtual host. I disabled the default site, enabled my virtual site and reloaded Apache.
$ sudo a2dissite 000-default && sudo a2ensite mysite $ sudo service apache2 reload
Finally, I tested my Laravel installation by loading localhost on my web browser to get Lavavel’s default home page.
Posted in Web DevelopmentTagged Apache, Larvel, Linux, Linux Mint, Ubuntu, Web Development1 Comment
Follow Denis' Technology Blog on WordPress.com
How to Set up a Minikube Lab with VMware Workstation
How to install Elasticsearch on Fedora 28
Versioning in Git using Tags
Getting the Duration of a Video with PHP
Splitting a file path in PHP
Denis G Noonan on How to install Elasticsearch o…
Max on How to install Elasticsearch o…
SutoCom on Installing Laravel on Linux Mi…
Denis G Noonan on Including Autoloader and …
thenewphalls on Including Autoloader and …
How to Set up a Minikube Lab with VMware Workstation
How to install Elasticsearch on Fedora 28
Versioning in Git using Tags
Getting the Duration of a Video with PHP
Splitting a file path in PHP
Denis G Noonan on How to install Elasticsearch o…
Max on How to install Elasticsearch o…
SutoCom on Installing Laravel on Linux Mi…
Denis G Noonan on Including Autoloader and …
thenewphalls on Including Autoloader and …
Follow Denis' Technology Blog on WordPress.com
How to Set up a Minikube Lab with VMware Workstation
How to install Elasticsearch on Fedora 28
Versioning in Git using Tags
Getting the Duration of a Video with PHP
Splitting a file path in PHP
Website Powered by WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.