Tampilkan postingan dengan label PHP. Tampilkan semua postingan
Tampilkan postingan dengan label PHP. Tampilkan semua postingan

How to make Virtual Host ?

Posted by Unknown Minggu, 10 Februari 2013 0 komentar
This is very silly blog but very useful to beginner in Web development.

How can we make virtual host !!

I am assuming that you are PHP developer and already installed XAMPP or separately installed Apache.

Step 1: Make Virtual host entry in httpd-vhost.conf file

httpd-vhost.conf file from installation folder of Apache.

Put below lines of code,


<VirtualHost *:80>
DocumentRoot /Path/To/Source/Code/
ServerName vhostname.example.com
<Directory 
/Path/To/Source/Code/>
AllowOverride All
Order deny,allow
Allow from all
</Directory>
</VirtualHost>




ServerName would be your virtual host name and DomentRoot and Directory would be path to source code.

Step 2 : Make Entry of domain name in Hosts file

Location of Hosts file,

Windows 95/98/Me : c:\windows\hosts

Windows NT/2000/XP Pro : c:\winnt\system32\drivers\etc\hosts

Windows XP Home and later versoin : c:\windows\system32\drivers\etc\hosts

Linux/Mac : /etc/hosts

Put below line at the end of file,

127.0.0.1     vhostname.example.com


Thanks for reading the Article!

Follow me @ Just iOS

Contact us @ Solution Analysts pvt. ltd.


Baca Selengkapnya ....

How to add Cron job under linux or unix based OS?

Posted by Unknown Sabtu, 05 Januari 2013 0 komentar
How to add Cron jobs / Scheduler under linux/unix/cent OS ?

It's damm easy!! 

If you are using Shared Hosting then your hosting provider must provide your cPanel Access to setup Cron Jobs, that's very easy and self explanatory. So not going explain here.

Let's think about Dedicated Hosting Servers.

If you are using service of Dedicated server, you must have SSH Access.

Connect your Server using any SSH client like PuTTY (For Windows users) and Mac user can use Built in Utility Terminal to connect Server.

Let's connect server, 

ssh foo@example.com

foo is username and example.com can be IP address or domain name.

For information you can see manual by below command.

man ssh

OHH!! Let's back to blog. How can I Install/Create/Modify Conjobs ?

fire below command,

crontab -e

this command will open cronjob file in edit mode.

To edit this file you must aware of VI Cheats.

Your cron would be like below,

1 2 3 4 5 /path/to/command arg1 arg2


  • 1: Minute (0-59)
  • 2: Hours (0-23)
  • 3: Day (0-31)
  • 4: Month (1-12) 12 == December
  • 5: Day of Week (0-7) 0 & 7 == Sunday, 1 = Monday and so on.
  • /path/to/command = Command or Script to execute
  • arg1 & arg2 = arguments 
Some, Examples.

To schedule a job to run after 5 minute every hour.

5 * * * * wget -q http://example.com/cron.php 

To schedule a job to run every 5 minute.

0-59/5 * * * * or */5 * * * * php /var/www/htdocs/cron.php

To schedule a job to run every hour of hours.
0 * * * * /var/ect/jobs/backup.sh

To schedule a job to run 10 minutes after midnight,every day

10 0 * * * /path/to/command

To schedule a job to run 05:01 pm of every 31st december of every year.

1 17 31 12 * /path/to/command  

To schedule a job to run at 12pm on weekends.

0 12 * * 1-5 /path/to/command

Operators ?

  • Astrick (*) : all posible values of fields
  • Comma (,) : list of values e.g. 1,2,3,5
  • Dash (-) : Range of values. e.g. 5-10
Output

By default Crontab send output to local email address. 
To prevent that you need to add >/dev/null 2>&1

* * * * * /path/to/command >/dev/null 2>&1

If you want to receive output of Cornjobs to any specific email address, you can add MAILTO variable to cron job.

MAILTO="jaym@example.com" 
* * * * * /path/to/command 

Some special shorthands,

@hourly : Same as 0 * * * *, Run every hour.
@midnight or @daily : Same as 0 0 * * *, Run every day midnight. 
@reboot : Run once after system starts.
@yearly or @annually : 0 0 1 1 *, Run once a year.
@monthly : Same as 0 0 1 * *, Run once a month.
@weekly : Same as 0 0 * * 0, Run once a week.

Usage:

@hourly /path/to/command

To list down all the Cron jobs, use below command which will list down all the running Cron jobs

crontab -l

Follow me @ Just PHP





Baca Selengkapnya ....

MS SQL (sqlsrv) : Problem with closing curly brace ( } )

Posted by Unknown Senin, 31 Desember 2012 0 komentar
Able to logged in using SQL Server management studio to MS SQL  server DB, But not able to logged in using PHP!!!

In these case please check you password. 

If you password contains closing curly brace ( } ) then you need to escape it using another  closing curly bracket.

Simple way if just use,

$password = str_replace($password,"}","}}");

Thanks for reading the Article.

Follow me @ Just PHP


Baca Selengkapnya ....
Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of apk zenonia 5.