Running PHP on a Windows 2008 R2 server - php

I am very new to web development and I have decided to learn the ropes of php with mysql. I am currently taking an online course from Lynda.com teaching me on concepts of php and mysql.
I have installed the WAMP server on windows 2008 box and I can start all the apache services and when I go to http://localhost it opens up the WAMP webpage and when I click on phpinfo() it takes me to my php page showing me the version (5.5.12)
I have also configured IIS using this link but no luck when I open my php file I get the source code display in my internet explorer with all the html formatting. Its just a simple "hello world" file and the file extension is *.php

Ok, I think I know where I was going wrong.. I had created folder on my desktop and then saved the php file in it and was browsing to that file from IE.
What I need to do is browse using http://localhost... so I placed the same file in the www folder under the WAMP directory and then did http://localhost/helloworld.php and it opened up!
But there should be away I can use files from my desktop instead of placing the files in the www folder...

Related

How to setup a PHP server?

I'm trying to set up a PHP server. We have an old server that runs a bunch of in house forms over an intranet that is coded in ASP, and I'm trying to rebuild that into a better system using PHP.
I'm starting fresh, as have been given a Win 2012 r2 server.
I first tried installing IIS 8. I installed downloaded the files for php (version 7). I was successful in being able to access index.html and any other files placed in the c/inetpub/wwwroot folder from a different PC via a browser (http://servername/file.php). However, I installed MariaDB and phpmyadmin. phpmyadmin gave the the message the mysqli extension is missing.
I ultimately uninstalled IIS, and PHP, and the MariaDB. I wanted to start from scratch, and tried with Apache
I was able to get Apache and PHP to work together, but I could not access files in the htdocs folder from a different PC (going to http://<servername>/file.php). I could only access it via localhost.
I had the same problems with phpmyadmin and mysqli.
I also noticed there was no php.ini file... rather I saw a php-ini-production and php-ini-development files.
How to I fix the phpmyadmin problem? Any advice for configuring apache so that I can access files place in the htdocs folder from a device other than the server itself (non-localhost)?
I recommend using XAMPP, then you'll have MySQL, and may be you could configure to use MariaDB as well.
If you use XAMPP, phpmyadmin is not available other than localhost, but that is configurable. If you want i can help you find a good video for that.
take the php-ini-production file and rename it to php.ini and find the line
;extension=php_mysqli.dll
and just remove the leading semicolon (;), save and restart apache.
Also you need to open the firewall on your machine to allow port 80 to accept all connections.

PHP extension in capital letter downloads source code

I've been coding on my Local Machine recently using PHP 5.6.30 Built-in Server, just today I moved my local host files to my Amazon EC2 Windows Server with PHP 5.6.30 already installed, scanning my website with Acunetix, I saw a bug/vulnerability which downloaded my source code just by changing .php (Small Letter) to .PHP(Capital Letter).
The Question is This:
Is this Normal for the Built-in Server to download my source code to visitor or hacker when .php is capitalized or my bug, I always try to prevent myself from being hacked by all means...
E.g
I have index.php on my localhost served through PHP 5.6.30 Built-In Server.
When User visit same page (index.PHP), it download the code...
I was able to figure this out by replacing the server PHP.ini to the php.ini-production, moving the server to APACHE and it stopped acting that way.
# castis hinted me on that word "production".
Thanks.

How to install php on windows 8.1 64-bit?

After studying html, css and Javascipt i have decided to study php.
But when i tried to do the first hello world example i found that its not working
<?php
echo "hello World";
?>
it shows like this:
After exploring a lot i found that i need to install php before studying it.
I explore a lot and couldn't find any sutable php for my windows 8.1 (64-bit).
I even installed xampp.
But failure
Please some one provide me link to download php for windows 8.1 (64-bit) and please guide me how can to install php and run it.
You should put your php files in c:/xampp/htdocs folder.
Then open your xampp control panel.
start apache and mysql application.
then open your browser goto http://localhost/yourphpfile.php.
Then you will get the output.
I think you should be following a good tutorial to learn php though.
Install Xampp on your windows
Open control panel of xampp
Run apache and Mysql
Inside the folder htdocs in C:\xampp create a new folder for your php work
Create Index.php file as the main file
Go to your favorite browser and search localhost/after the slash add your folders name so that you can go to that folder

Phpinfo.php browser trying to download instead of running

HI I am trying to configure IIS7 to run PHP on a windows 2008 server machine.
I have followed this guide, php running on IIS7
Everything went well and I am sure it was working!!
However now when I try and run phpinfo.php the browser wants to download the page rather than running the script.
The handler mapper is configured the same as the the example. fastCGI/CGI is installed and enabled.
a normal index.html open no problem.
I have checked permissions, created a new empty site apart from phpinfo.php
I developed the site on my pc in a xampp environment where everything work great. First time I have tried to convert a site from xampp to IIS.
Their is no entry in the MIME Types, I am wondering if the WEB.CONFIG file is the issue but I don't know enough about what the file should/shouldn't contain.
thanks for any help
you can use http://php.iis.net/ to install php into your IIS setup. It comes with a manager to help you easily implement php in to your iis server and is way easier then trying to configure it manually. Hope this helps.

XAMPP (LAMPP) server not serving php files properly, browser tries to download the script & weird behavior

I'm starting a new project using Linux and PHP, but for the early dev state i'm now, I'm trying to use XAMPP for now.
I'm Running Ubuntu 10.04 x64 on a laptop, And got everything I need. The site I should build is based upon CodeIgniter and some implementation of smarty, but I think this is not that important because the same site runs pretty well on windows (with XAMPP )
The Problem I have is, if I put some php file on the root (like foo.php) with phpinfo() on it, the server parsed it as it should be, but when I try to get the url for one CodeIgniter app (as http://localhost/site/site.php ), Firefox tries to download the file & Chrome alerts some server error.
Again, the site as it works perfectly on windows (I share code using mercurial, if that's important)
I have around 3 codeigniter apps sharing the same System folder, and those get pickup by the loader (as site.php, admin.php...), but anyone I pick I still getting the same msg.
Also, the server list all the files perfectly, and tried to rename the file and then asked for the same (to see if the problem is cache or something) but I get a 404.
I'm also a newbie on apache and linux in general, I don't know what to do...
Check your apache.conf and httpd.conf. There are configuration entries called AddHandler which assign a module to each file extension which should handle this. If no module is provided the apache will send the file as plain text to the client.

Categories