PHP the easy way
If you have a website with PHP-files, you can install a webserver-package with PHP, Apache webserver and MySQL for example, one like Xampp, Wampserver or whatever. But that can bring some serious trouble too: often you need to change several settings and other additional software to make everything work and it can therefore become pretty annoying.
But what if you only need PHP? Is there a simpler way to maintain your website offline?
Yes there is, let me explain: you can go to the downloadpage of php.net or if you are on windows even easier: go to the windows-downloadpage.
Preparing for installation
Download the PHP-version you want (look for the version you´re running on your website) and extract the package to any folder you want.
In the root folder where you unpacked the zipfile exists a file called "php.exe". Starting this file alone is not going to work, you need to give it some extra info.
Getting it done
Now, I have unpacked the downloaded file to my external harddrive called D in the folder "progs" and my website exists also on my external harddisk D in the folder "D:\Documents\Hobby\Internet\Websites\exdomo".
I opened my text-editor and typed the following text to make a batchfile (the second line starting with D: and ending with exdomo should not have line-breaks)
@echo off
D:\progs\php\php.exe -S localhost:8080 -t D:\Documents\Hobby\Internet\Websites\exdomo
pause
Then I saved this file on my harddisk with the name: server.bat
Note: slashes need to be backslashes in your batchfile).
To this file I added a shortcut on my desktop.
Now when I click the shortcut the start-up screen appears and when I open my webbrowser and type in the adress bar: "localhost:8080" I see the website offline.
Exit php using ctrl-c and answering the question with "Y"
Reacties
Een reactie posten