I just learned to use PHP, beginning from Codecademy and W3school and keeping studying by asking Google/Baidu when encounting problems as I go. I developed a simple website for DISC project, which I might write a blog to describe in the future. This blog records how to configure the PHP development environment for Ubuntu and Windows, as well as my attempt to simulate POST FORM using Snoopy.php
Install Apachehtml
sudo apt-get install apache2
Install PHPmysql
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
Install MySQLweb
sudo apt-get install mysql-server
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadminsql
gksudo gedit /etc/php5/apache2/php.iniapache
extension=mysql.socookie
sudo /etc/init.d/apache2 restartcurl
I've tried for several days to configure some PHP IDE with Apache on Windows. In the end, I found a pretty much simple way to do it -- WAMPSERVER + EPP3. oop
The wampserver downloaded from official website doesn't work on my Windows 7 x64 OS, then I downloaded an old version of wampserver from Baidu Software which works. The EPP 1.2.2 doesn't work well either, while EPP3 works. Actually it won't be troublesome if I just use Apache and any editor to wite code, not IDE.post
In WAMPSERVER need to click "Put Online"
Edit Apache -> httpd.conf -> "DocumentRoot" & "<Directory ...>"
Note EPP3 project files should be placed at the subdirectory of the Apache root www directory.
The following is part of the Snoopy README document
What is Snoopy? Snoopy is a PHP class that simulates a web browser. It automates the task of retrieving web page content and posting forms, for example. CLASS METHODS: fetch($URI) ----------- This is the method used for fetching the contents of a web page. $URI is the fully qualified URL of the page to fetch. The results of the fetch are stored in $this->results. If you are fetching frames, then $this->results contains each frame fetched in an array. fetchtext($URI) --------------- This behaves exactly like fetch() except that it only returns the text from the page, stripping out html tags and other irrelevant data. fetchform($URI) --------------- This behaves exactly like fetch() except that it only returns the form elements from the page, stripping out html tags and other irrelevant data. fetchlinks($URI) ---------------- This behaves exactly like fetch() except that it only returns the links from the page. By default, relative links are converted to their fully qualified URL form. submit($URI,$formvars) ---------------------- This submits a form to the specified $URI. $formvars is an array of the form variables to pass. submittext($URI,$formvars) -------------------------- This behaves exactly like submit() except that it only returns the text from the page, stripping out html tags and other irrelevant data. submitlinks($URI) ---------------- This behaves exactly like submit() except that it only returns the links from the page. By default, relative links are converted to their fully qualified URL form. CLASS VARIABLES: (default value in parenthesis) $host the host to connect to $port the port to connect to $proxy_host the proxy host to use, if any $proxy_port the proxy port to use, if any $agent the user agent to masqerade as (Snoopy v0.1) $referer referer information to pass, if any $cookies cookies to pass if any $rawheaders other header info to pass, if any $maxredirs maximum redirects to allow. 0=none allowed. (5) $offsiteok whether or not to allow redirects off-site. (true) $expandlinks whether or not to expand links to fully qualified URLs (true) $user authentication username, if any $pass authentication password, if any $accept http accept types (image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*) $error where errors are sent, if any $response_code responde code returned from server $headers headers returned from server $maxlength max return data length $read_timeout timeout on read operations (requires PHP 4 Beta 4+) set to 0 to disallow timeouts $timed_out true if a read operation timed out (requires PHP 4 Beta 4+) $maxframes number of frames we will follow $status http status of fetch $temp_dir temp directory that the webserver can write to. (/tmp) $curl_path system path to cURL binary, set to false if none