Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Wednesday, August 30, 2017

How-To: Schedule Full Automatic cPanel Backups for MySQL Databases and Files using the Cron

Update Oct. 2012!

This script has been thoroughly revised and updated and works with the latest version of cPanel and WHM. And it’s still free! Also, a new version of the WHM reseller backup script has been released.
The guide in this video is for version 1.0 of the script. It has since be updated significantly – you should edit config.php instead
Ensuring your website and data are safe in the event of a disaster can be a tricky and time consuming task.
Have you recently made a complete backup of your website?
“No” is not a option any more – it’s easy with the right tools.
For those of you who don’t have professional grade Managed WordPress Hosting that handles all this for you, we have built a script that will completely automate your daily/weekly backups.
We have built it for those out there that use cPanel (so we don’t support Plesk, sorry).

Schedule automatic web hosting backups for your MySQL and file Data

Of course, this automation script is completely free and we encourage you do to download it and set it up.
Further, to make it easy we have provided a clear step-by-step how-to video so you can implement it yourself in about 5 minutes without any hassle whatsoever.

Automatic backups in 4 easy-to-follow steps

  1. Download the script that we wrote.
  2. Edit the script with your web hosting details
  3. Upload the script to your web hosting using your FTP client
  4. Setup the automation (“cron” job)
You can download the cPanel backup script written in PHP here.

Easy to follow Video guide on how to setup the CPanel automatic backup

To make things super easy for you, I have put together a 4 minute video that outlines all you need to get the automation script installed on your web hosting site.
If you have any issues, please feel free to write a comment below, or on the Video on YouTube.

What Next?

If you’re having hassles with your web hosting and would prefer someone look after your website ensuring that you’re secure and your data is always backed up, please have a look at our Managed WordPress Hosting option.
Of course, if you’re just starting out, remember you can get a brand new, top-class website based on WordPress for only 100!

Use the form below to join our Developer Channel

Do you need an automated CPanel web hosting backup script? There is that and more in the Developer Channel

source : https://www.hostliketoast.com/2011/09/how-to-schedule-full-automatic-cpanel-backups-mysql-databases-files-cron/

Tuesday, April 9, 2013

Install IIS 7.5 PHP & FastCGI for PHP on Windows 7


Why install IIS?
Obviously you want to design web sites on your local computer and test them before uploading to your web server.

Why install FastCGI and not ISAPI?
Up until php version 5.3 most web developers using php installed ISAPI
From php version 5.3 on ISAPI is not longer supported.
The alternative is to use FastCGI
Although there are many web sites complaining about this change ISAPI works well for a website with 0-20 users,
however FastCGI runs much faster under a heavy user load and equally as well with smaller loads.

This guide has been updated and rewritten as the easiest way to successfully Configure IIS 7.5 to work with FastCGI and PHP on Windows 7 is to use
Microsoft Web Platform Installer 2.0 from http://www.microsoft.com/web/Downloads/platform.aspx
Why?
The installer does all the hard work
No more downloading PHP then configuring the php.ini file
No more going into your Internet Information Services (IIS) Manager and adding a Handler Mapping FastCGI Module
No more going into your System Properties and setting up your Environmental Variables
No more spending endless hours surfing around looking for solutions that help you get it all working (it rarely happens first time)
Microsoft have done all the hard time consuming work for a change - miracles do happen.

NOTE: This install was completed on Windows 7 Ultimate 64 bit and works for 32 bit systems.

STEP 1

Open the site and click on Download It Now
Download it to your chosen folder


Step 2

Open the folder you downloaded to & double click wpilauncher


Step 3

Click Run


Step 4

Wait

Step 5

Select to programs you wish to install
In this case click on Web Platform in left column
Go to Frameworks and Runtimes then click Customize

 

Step 6

Now just tick the boxes under PHP
Click Install


Step 7

Now wait while Web Platform Installation downloads, installs & configures your files


Step 8

Success! - click Finish


Step 9

Now to check the install - go Start then Run
If Run does not appear on menu simply type Run in 'Search progams and files' box


Step 10

Type cmd



Step 11

The screen below appears - after C:\Users\User> type cd c:\PHP
Hit 'Enter' on keyboard



Step 12

After c:\PHP> type PHP -info
Hit 'Enter' on keyboard
Watch the screen



Step 13

The screen below is the bottom of the file


Step 14

Next test
Open Notepad and type <?php phpinfo();?>


Step 15

Save (using Save As...) the file in C:\inetpub\wwwroot as info.php


Step 16

Save php.info file here


Step 17

Close open folders
Open browser and type http://localhost/info.php
The file below should come up on the screen.
Success!
Note: This screen can provide a lot of information about your setup that may come in handy in the future.

Congratulations! - you have now Installed, Configured & Tested IIS 7.5 & PHP & FastCGI

The next step is using databases such as MySQL and Interfacing it with PHPMyAdmin, links below

NOTE: This installation does NOT enable mcrypt by default - see link below
In PHPMyAdmin you will receive the following
PHPMyAdmin Error "Cannot load mcrypt extension. Please check your PHP configuration"

Wednesday, May 9, 2012

6 PHP classes พลาดแล้วจะเสียใจไปทั้งชาติ

ในโลกของ php นั้นช่างเป็นโลกแห่งการเอื้อเฟื้อเผื่อแผ่โดยแท้ มีโค้ดดีๆแจกให้ใช้งานเยอะแยะ ถ้าเรานั่งเขียนเองนะครับ คาดว่าต้องใช้เวลาเป็นเดือนๆ กว่าจะเสร็จสักคลาส
เชื่อมั้ยครับว่า คลาสหลายๆตัว ผมเห็นแล้วอึ้ง เมื่อนำมันมาใช้นี่ ช่วยผ่อนแรงเราได้มากเลยทีเดียว และอีกอย่างหนึ่งก็คือ คลาสเหล่านั้น โปรแกรมเมอร์เขาพัฒนาอยู่ตลอด ซึ่งนั่นหมายความว่า มันเหมือนมีคนช่วยเขียนโค้ดเรา
มาดูกันดีกว่าครับ

1. class.upload.php

คลาสตัวนี้ไว้ใช้สำหรับอัปโหลดภาพ ขึ้นเว็บ ความสามารถนั้นเหลือร้ายจริงๆ ตั้งแต่ ย่อภาพ , ขยายภาพ, ทำภาพซ้อนภาพ, ใส่ลายน้ำ ,สร้างโฟลเดอร์เก็บภาพอัตโนมัติ และอีกเยอะแยะครับ ที่สำคัญเหนือสิ่งอื่นใด มันใช้ง่ายมากๆ คลาสตัวนี้ผมใช้เป็นประจำเลยครับ เรียกได้ว่าผมเอาติดโปรเจ็กไว้เสมอ

2. fpdf

คลาสตัวนี้ไว้ใช้สำหรับ export ข้อมูลออกมาเป็นไฟล์ pdf ใช้งานง่ายมากๆ เสียอยู่อย่างเดียวคนเขียน doc เขียนได้ไม่ค่อยเคลียร์เท่าไร ต้องใช้เวลาศึกษานิดนึง แต่หลังจากจับทางได้แล้วผมเชื่อว่าท่านจะชอบ

3. Securimage CAPTCHA

คลาสตัวนี้ไว้สำหรับป้องกันแสปม ผมเขียนวิธีการใช้งานไว้ในบทความ เด็ดปีกแสปมด้วย Securimage CAPTCHA

4. pChart

ไว้ใช้สำหรับสร้างกราฟแบบมืออาชีพ ผมไม่รู้จะบรรยายสรรพคุณยายังไงดี บอกได้เพียงแค่ว่ามันสุดยอดครับ ลองศึกษาดูเถอะไม่ผิดหวังแน่นอน

5. PHPExcel

ชื่อก็คลาสก็พะยี่ห้ออยู่แล้วครับว่าไว้ใช้ทำอะไร ถ้าท่านต้องการจะ export ข้อมูลออกไปเป็น excel หรือต้องการอ่านข้อมูลออกจากไฟล์ excel ต้องใช้ตัวนี้เลยครับ ซัพพอร์ต excel 2003,2007 ที่เด็ดสุดๆก็คือ document อธิบายการใช้งานครับผม เขียนละเอียดจริงๆ

6. LastRSS

ไว้ใช้สำหรับดึงไฟล์ RSS มาแสดง ลองอ่านบทความที่ผมเคยเขียนเกี่ยวกับคลาสตัวนี้ดูครับ ดึง RSS มาแสดงในเว็บ ง่ายๆ ด้วย lastRSS ท่านน่าจะเข้าใจได้แจ่มชัดขึ้น ว่ามันไว้ใช้ทำอะไร

Monday, October 24, 2011

Configuring PHP Extension on Windows - A simple way


There has been too many problem reported in our forum about not able to configure one particular extension. The problems are many:
  • Configuring a non-compatible version of the extension
  • Missing some dependent DLL
  • Trying to use thread safe version of the extension DLL  for non thread safe PHP build and vice-versa
If you have configured a PHP extension and you can't see it loaded, I generally run the command (assuming your PHP is installed at 'C:\Program Files\PHP')
'C:\Program Files\PHP\php-cgi.exe' -v from the command prompt.
This really helps in catching some error.
So what's the best way to configure a PHP extension. I would say if the extension you are trying to install is available as part of PHP MSI, it is the best idea to use the PHP MSI to configure your extension. There is no manual step involved and all right dependent DLL will also get installed. Plus your PHP.INI file gets updated automatically. Now I am going to tell you how to achieve this from a PHP MSI UI. Let me warn you this is for novice user. Expert ones can just skip this. So here are the steps:
  • Go to Control Panel
  • Click on Add/Remove Program (Or, Uninstall a program)
  • Select PHP MSI and click on 'Change'. Remember you should have installed PHP using the PHP MSI. If you have installed it using the ZIP file this won't work.
  • You will see the below UI.
image
  • Click on Next, following UI will appear.
image
  • Click 'Change'
image
  • Select 'IIS FastCGI'
image
  • Chose the extension you want to install and click 'Next'.
image
  • Click on 'Change'
  • Click on 'Finish' on next screen and you are done.
So you now know how easy it is to install a PHP extension using the MSI.
Hopefully this will help you in setting up your PHP extension. Thanks for the patient reading and good bye.

ref : http://blogs.iis.net/donraman/archive/2009/10/16/configuring-php-extension-on-windows-a-simple-way.aspx

IIS 6.0 with FastCGI + PHP

ปกติประสิทธิภาพในการรันเว็บที่เป็นภาษา PHP บน IIS จะสู้บน apache ไม่ได้ เพราะบน IIS มีรูปแบบการสั่งงานที่รองรับแบบ CGI ที่ทำงานได้ช้ามาก หรือจะให้ดีหน่อยก็สามาถใช้แบบ ISAPI ได้ แต่ก็ทำให้เว็บ PHP ทำงานได้ไม่ถูกต้อง มาวันนี้ไมโครซอฟท์พึ่งจะได้ออกส่วนเพิ่มเติมของ IIS ให้สามารถใช้ FastCGI ได้แล้ว ประสิทธิภาพที่ดีขึ้นแบบเห็นได้ชัด การทำงานก็ปกติ กิน ram น้อยไม่เหมือนตอนรันแบบ ISAPI มาดูวิธีติดตั้งกัน

* สมมติว่าได้ติดตั้ง php ไว้แล้วที่ c:\php และมีไฟล์ php-cgi.exe
อันดับแรกไปโหลด FastCGI Handler for IIS 6.0 มาก่อน
fcgisetup32.msi
โหลดเสร็จแล้วให้เีรียกติดตั้งเลย ไม่มีอะไรมากมาย
เมื่อติดตั้งแล้วจะพบ 3 ไฟล์นี้ C:\Windows\system32\inetsrv\
  • fcgiext.dll
  • fcgiext.ini
  • fcgiconfig.js
ขั้นตอนต่อไปเพิ่ม fcgiext.dll ลงใน extension mapping สำหรับไฟล์ .php
IIS > Web Sites > properties > Home Directory > Configuration… > Add…

ต่อไปเปิดไฟล์ fastcgiext.ini ขึ้นมาแก้ ใส่ตอนท้ายๆ ไฟล์
[Types]
php=PHP

[PHP]
ExePath=c:\php\php-cgi.exe

สำหรับ option อื่นสามารถดูได้ในไฟล์ fsgiext.ini

ขั้นตอนสุดท้ายให้แก้ไขไฟล์ php.ini โดย แก้บรรทัดนี้
fastcgi.impersonate = 1


RESTART IIS เสร็จ ก็ใช้งานได้เลย