http://localhost/myphpadmin/index.php only shows code - php

I installed Apache onto my C: drive. (C:/Apache).
I then installed phpmyadmin and placed it inside a folder (htdocs) inside C:/Apache.
I followed a youtube installation example for Apache. When it asked me my domain name and server, I copied what the tutorial said to put, which was "localhost" for both fields.
After both Apache and phpmyadmin had been installed and set up, I tried accessing phpmyadmin, but all I got was a lot of code.
I am wondering, if, when I was installing Apache, if, I should have typed bravehost.com or my bravehost server name, instead of localhost.
When I try to access the Phpmyadmin login page (index.php), I only get a page full of code instead of the login page.
How can i do this ?

PhpMyAdmin will only work if you have PHP installed and linked to Apache as a recognized plugin by editing the httpd.conf file within Apache. If you have not done this, the browser has no way of knowing how to parse the PHP code. I advise directly downloading and using a WAMP Stack (like Zend, XAMPP or WAMPServer) which would have PHP, Apache, MySQL and phpmyadmin pre-configured. Would be easy for you to begin with.

Install php
Enable php and check through phpinfo()
Isntall mysql
Install phpmyadmin
After installation by default pma url is localhost/phpmyadmin (or what eve you setuped while installation). Remember that pma is only php scripts (it's not soft as apache\mysql\php).
If you see php code on pages it means that php is not working and apache give you 'raw' code. Re-check that your php is enabled and is working.

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.

Wordpress index.php doesn't load on local server

I have a working wordpress site online, running on an Ubuntu 16.04 VPS. I've typically just edited the files via FTP, but I'm trying to get more organized. I'm setting up a development machine with VirtualBox running Ubuntu 16.04 (with Windows as the host OS) so I can experiment. I'm having trouble getting wordpress to load.
I've copied the website files into the VM. I have PHP 7.0.12 installed in the VM. I have the database copied over and it's running fine in the VM. I start the PHP server with
cd /path/to/website/public
php -S 0.0.0.0:8080
When I visit localhost:8080 from Chrome in Windows, I get a Page not found error in chrome. However, I create a public/info.php file with <?php phpinfo(); ?>, and then visit localhost:8080/info.php, I get the correct PHP info page.
I also tried configuring Nginx inside the VM like I have it on the real server. I get the exact same results as with the built in PHP server.
When I visit localhost:8080/wp-admin, I get redirected to the admin page of the live server.
Any idea on what I'm missing or how I might go about debugging the issue?
When move WordPress to another domain, Instead of directly copying Database, we have to use Database migration plugins or manually updating content on DB.
https://wordpress.org/plugins/wp-migrate-db/
https://codex.wordpress.org/Moving_WordPress#Changing_Your_Domain_Name_and_URLs
Then use this updated DB and copied files. That will solve your issue.

cannot run the localhost with upgraded php version and mysql version

My localhost was running on wampserver 2.0 ( with php5.3.0 , mysql5.1.16 , Apache 2.2.11). I needed to upgrade php and mysql, so i downloaded php 5.6.16. and extracted in to directory "wamp/bin/php/php5.6.16" with 3 mandatory files ( php configuration file, phpForApache configuration file and wampserver.conf file) from existing php5.3.0 folder.
Then I got a mysql from my friend's (mysql5.6.12 64bit) wamp directory. didn't do any configurartion. I put it into my wamp/bin/mysql. then i exited from wamp and restart it again.
Then php and mysql versions look like this.
mysql version is not displayed here. and the existing version name is not selected. with these changes I executed the localhost on browser.
wamp server home page is displayed on the browser.
Then I could see this.
In above image, the updated Mysql version is displayed, but not displayed in wamp tray menu mentioned before.
After I tried to view phpmyadmin page. the page was not loaded.
When I'm trying to select mysql version5.1.36 from wamp tray menu, following error was occurred.
Special: after this error occurred, the wamp go offline and cannot open localhost.
And also when I select php version 5.6.16 from wamp tray menu and start localhost, but it goes for " unable to connect" page.
Then I removed the new mysql 5.6.12 folder from the wamp/bin/mysql directory. then restart services and try again.
Nothing changes happened. when start the localhost I could see mysql version again as before.(MySQL Version :
5.6.12 ). But I already removed it from the directory.
I explained everything that i faced.
I need to know what is going on here and how to fix these problems. and How do I install php and mysql versions in this wampserver 2.0.
A working WAMP install should come with included MySQL and PHP versions. That's the whole point of using a package such as WAMP instead of installing your own; you get a whole working stack with one installation instead of having to install each application individually and then configure them manually to work together. Therefore, I have no idea why you would want to copy a friend's MySQL application to your computer. Aside from the fact that you probably didn't copy all the system files (DLLs, library files, etc), you're probably introducing conflicts with the library files that PHP and WAMP use to access MySQL since it's expecting a particular version and now you're providing a different version.
Frankly, at this point it sounds like things are messed up enough that probably the only proper solution is to remove what you have and reinstall the WAMP package (or each individual component). Make sure you back up any relevant changes you've made (configuration, web files, and databases) first!
First of all take back up of all local website in WWW directory found in wamp folder.. This is a time consuming time as it has to back up and copy all files, so sit aside and be patient.
Now, the only solution for this error is to uninstall wamp from control panel and than get tne new version of wamp according to your needs wither from archive or directly the latest version with your preferred php, mysql and apache versions. Follow this steps for backing up and recovering your old projects.:-
Before uninstalling the crashed server copy the full folder as backup of all previous data. (Example: Take backup of "C:\wamp" folder)
Uninstall the Crashed server and install the new one.
Make sure your new server running and has no error.
If server is running make it Stop and Offline then close it.
Go to C:\wamp\bin\mysql\mysql5.0.45\data\
Its better to take a backup copy of this data folder.
Replace the files and folders with your previous server data.
Add your Previous Projects to the Root folder. (Example: "C:\wamp\www")
Restart the server and check whether your previous tables and data are reflecting in the new server. (Example: Check it Out here http://localhost/phpmyadmin/)
Enjoy with your Old Projects at new server.
Source:- mysql.com
From:- http://infinium-tech.com

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