Landslyde Posted December 8, 2014 Share Posted December 8, 2014 First thing: I formatted my drive today and fresh installs of Apache2, PHP5 and MariaDB on Linux Mint 17.1. No files have been messed with. Not one. I created info.php and placed it in var/www dir. The file consists of one line: <?php phpinfo(); ?> When I run it our of my web editor (Bluefish), instead of showing me on my web browser the PHP info page that's suppose to show, I get: <?php phpinfo(); ?> I've been fighting this for two days! Done everything suggested by many others online...and that's why I had to scrub my drive; forgot all the files I augmented. Does anyone know why my PHP files behave this way? I'd love to start working with PHP, but I can't until whatever's broken is fixed. Any ideas? Any suggestions? I'm at my wit's end with this. Landslyde Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/ Share on other sites More sharing options...
LeJack Posted December 8, 2014 Share Posted December 8, 2014 (edited) Did you manually install it or did you use the yum install? Edit: Or even the rpm install? Edited December 8, 2014 by LeJack Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498924 Share on other sites More sharing options...
Landslyde Posted December 8, 2014 Author Share Posted December 8, 2014 (edited) Did you manually install it or did you use the yum install? Edit: Or even the rpm install? Sorry. Linux Mint is Debian, so the install was sudo apt-get. After installing my OS, I installed apache2, php5 and a few others like MariaDB. All were installed separately from one another. In other words, I didn't use LAMP. Edited December 8, 2014 by Landslyde Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498925 Share on other sites More sharing options...
LeJack Posted December 8, 2014 Share Posted December 8, 2014 Sorry. Linux Mint is Debian, so the install was sudo apt-get. After installing my OS, I installed apache2, php5 and a few others like MariaDB. All were installed separately from one another. In other words, I didn't use LAMP. That's fine. Umm, When you go to localhost, does it give you the default Apache webpage stating that you've installed Apache correctly? Have you configured your Apache settings using gedit? Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498926 Share on other sites More sharing options...
Landslyde Posted December 8, 2014 Author Share Posted December 8, 2014 That's fine. Umm, When you go to localhost, does it give you the default Apache webpage stating that you've installed Apache correctly? Have you configured your Apache settings using gedit? Yes, I get the default Apache page. But no, I haven't edited any files, Apache or otherwise. From your question, I think I was suppose to. But I wldn't know where to start Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498929 Share on other sites More sharing options...
LeJack Posted December 8, 2014 Share Posted December 8, 2014 Yes, I get the default Apache page. But no, I haven't edited any files, Apache or otherwise. From your question, I think I was suppose to. But I wldn't know where to start Ok, so if you're seeing the default Apache page, that means you've installed it correctly. Next, I would use sudo gedit and edit the httpd.conf file. I'm not sure exactly where it's located cuz I use Fedora, but umm find the line that says <IfModule mime_module> # # TypesConfig points to the file containing the list of mappings from # filename extension to MIME-type. # TypesConfig conf/mime.types In that section, check to see if you have php added, if not. Add in this line. AddType application/x-httpd-php .php The reason why you are seeing just the plain PHP code is because PHP isn't enabled like this. Sometimes you might have to actually add in the mime types or you won't see it. I'm not sure if I'm right, but you can try that. Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498930 Share on other sites More sharing options...
Landslyde Posted December 8, 2014 Author Share Posted December 8, 2014 Ok, so if you're seeing the default Apache page, that means you've installed it correctly. Next, I would use sudo gedit and edit the httpd.conf file. I'm not sure exactly where it's located cuz I use Fedora, but umm find the line that says <IfModule mime_module> # # TypesConfig points to the file containing the list of mappings from # filename extension to MIME-type. # TypesConfig conf/mime.types In that section, check to see if you have php added, if not. Add in this line. AddType application/x-httpd-php .php The reason why you are seeing just the plain PHP code is because PHP isn't enabled like this. Sometimes you might have to actually add in the mime types or you won't see it. I'm not sure if I'm right, but you can try that. Debian doesn't use the httpd.conf file. I had read that it uses appache2.conf, but I checked for what you told me to look for and it isn't there. I checked not only that file but all files in all the folders in that dir. Now what? Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498931 Share on other sites More sharing options...
QuickOldCar Posted December 8, 2014 Share Posted December 8, 2014 use taskel and install it sudo apt-get update sudo tasksel install lamp-server Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498932 Share on other sites More sharing options...
Landslyde Posted December 8, 2014 Author Share Posted December 8, 2014 (edited) use taskel and install it sudo apt-get update sudo tasksel install lamp-server What's tasksel? I ask because this command isn't found on Linux Mint. Should I just use: sudo apt-get install lamp-server ? woogi@woogi-VPCEH1AFX ~ $ sudo tasksel install lamp-server [sudo] password for woogi: sudo: tasksel: command not found Also, will I need to purge and autoremove apache2 before installing it with LAMP? Edited December 8, 2014 by Landslyde Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498933 Share on other sites More sharing options...
LeJack Posted December 8, 2014 Share Posted December 8, 2014 (edited) Debian doesn't use the httpd.conf file. I had read that it uses appache2.conf, but I checked for what you told me to look for and it isn't there. I checked not only that file but all files in all the folders in that dir. Now what? Hmmm, try doing sudo apt-get update. I remember when I had to install PHP on my Ubuntu machine and I had the same problem. I believe I just used sudo apt-get upgrade because after that, it started working for me. Or try re-installing it again. Maybe some plugins didn't install correctly. Edit: Looks like QuickOldCar got to it before I did. Edited December 8, 2014 by LeJack Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498934 Share on other sites More sharing options...
QuickOldCar Posted December 8, 2014 Share Posted December 8, 2014 install taskel first then sudo apt-get install tasksel Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498935 Share on other sites More sharing options...
Landslyde Posted December 8, 2014 Author Share Posted December 8, 2014 (edited) Hmmm, try doing sudo apt-get update. I remember when I had to install PHP on my Ubuntu machine and I had the same problem. I believe I just used sudo apt-get upgrade because after that, it started working for me. Or try re-installing it again. Maybe some plugins didn't install correctly. Edit: Looks like QuickOldCar got to it before I did. Yeah. I appreciate all of you guys helping me. But I'm going to throw in the towel on this and forget abt PHP altogether. You see, only a couple hours ago I updated and upgraded. Nothing brought me closer to being able to PHP like the rest of the world does. And my fight with this has been two very very long days. But while I have no love whatsoever for JSP, at least it works for me on NetBeans. So I guess that's the way I'll go. Thanks again for all your help...all of you. LOL! Just when I closed this I had a new msg from QuickOldCar (hope it's a Mustang!). So, out of respect, I'll install LAMP and see where it takes me. I'll post again on this. Edited December 8, 2014 by Landslyde Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498936 Share on other sites More sharing options...
LeJack Posted December 8, 2014 Share Posted December 8, 2014 Yeah. I appreciate all of you guys helping me. But I'm going to throw in the towel on this and forget abt PHP altogether. You see, only a couple hours ago I updated and upgraded. Nothing brought me closer to being able to PHP like the rest of the world does. And my fight with this has been two very very long days. But while I have no love whatsoever for JSP, at least it works for me on NetBeans. So I guess that's the way I'll go. Thanks again for all your help...all of you. You shouldn't give up yet. Un-install everything. Then re-install everything. Install Apache first, then install PHP. Here, I'll give you a link that might help you out in a PM. Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498937 Share on other sites More sharing options...
Solution QuickOldCar Posted December 8, 2014 Solution Share Posted December 8, 2014 taskel may be deprecated you can just as well do it this way sudo apt-get update sudo apt-get install lamp-server Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498938 Share on other sites More sharing options...
Landslyde Posted December 8, 2014 Author Share Posted December 8, 2014 You shouldn't give up yet. Un-install everything. Then re-install everything. Install Apache first, then install PHP. Here, I'll give you a link that might help you out in a PM. I just installed LAMP through the use of tasksel as suggested by QuickOldCar. I get the same thing!! When I run the info.php file, which, again, consists of one line <?php phpinfo(); ?> that line is what I see on the webpage. Why won't this work? I mean I formatted my drive today and started from scratch! Then installed LAMP, the same things I already had installed, and it still refuses to cooperate!! This is crazy. And once again, I'm open to suggestions...up to and including blowing up my laptop! Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498939 Share on other sites More sharing options...
QuickOldCar Posted December 8, 2014 Share Posted December 8, 2014 Is there any difference running http://127.0.0.1/info.php versus http://localhost/info.php Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498940 Share on other sites More sharing options...
QuickOldCar Posted December 8, 2014 Share Posted December 8, 2014 One thing that may be causing issues is something else is using your apache port 80 skype is one of them try starting apache first, then other apps that possibly uses port 80 Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498942 Share on other sites More sharing options...
LeJack Posted December 8, 2014 Share Posted December 8, 2014 Is there any difference running http://127.0.0.1/info.php versus http://localhost/info.php It shouldn't be any different because it's running the same Apache configuration. All I can think of right now is the .conf file is missing some key configurations, but I could be wrong. I remember I just had to update my Ubuntu and it worked. I'm not really sure what's going on with LandSlyde's localhost. Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498943 Share on other sites More sharing options...
QuickOldCar Posted December 8, 2014 Share Posted December 8, 2014 I'll tell you what I do when I want a local server and also be able to use it normally I install ubuntu server then install kubuntu desktop gui via commandline sudo apt-get update && sudo apt-get upgrade sudo apt-get install kubuntu-desktop always works for me Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498944 Share on other sites More sharing options...
Landslyde Posted December 8, 2014 Author Share Posted December 8, 2014 (edited) QuickOldCar: LeJack: God bless both of you!! I now have PHP the way the rest of the world does! Everything works! You guys meet me at Joe's in an hour...the drinks are on me! I installed Lamp, although I removed MySQL and reinstalled MariaDB, watched a video shot to me by LeJack and...lol...the rest is history! I will be a contributor here for a long time to come. This is the most helpful forum I've ever been on. PHPFreaks ROCKS!! Thanks again I do have one more question though: Do I have to store all of my php files in var/www/html for testing? They can't be somewhere on my Desktop in a folder? I ask because I can access regular html files from a desktop folder and use them...but it seems php is a special case. Just wondering. Edited December 8, 2014 by Landslyde Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498945 Share on other sites More sharing options...
LeJack Posted December 8, 2014 Share Posted December 8, 2014 QuickOldCar: LeJack: God bless both of you!! I now have PHP the way the rest of the world does! Everything works! You guys meet me at Joe's in an hour...the drinks are on me! I installed Lamp, although I removed MySQL and reinstalled MariaDB, watched a video shot to me by LeJack and...lol...the rest is history! I will be a contributor here for a long time to come. This is the most helpful forum I've ever been on. PHPFreaks ROCKS!! Thanks again I do have one more question though: Do I have to store all of my php files in var/www/html for testing? They can't be somewhere on my Desktop in a folder? I ask because I can access regular html files from a desktop folder and use them...but it seems php is a special case. Just wondering. Well, you could, but I'm not sure how to configure Apache to point to a different destination cuz I have mine installed on Windows so I basically installed mine in my C drive. I believe it's possible to install your workspace on other places, but you'll have to configure it in the apache2.conf file. Not sure if that helps. Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498947 Share on other sites More sharing options...
QuickOldCar Posted December 8, 2014 Share Posted December 8, 2014 It used to always be var/www The new default web server location is var/www/html, the answer is yes The php won't get parsed unless you ran it from cli(command line interface) or in that folder Mostly due to permissions is best to do it from the public html folder You could include or require files (a php script for whatever reason) from outside of the public html folder though For instance wanting to include a list of sensitive passwords to check against stored in a csv file located in /var/passwords Btw welcome, visit php.net for some tutorials,examples and a wealth of information Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498948 Share on other sites More sharing options...
Landslyde Posted December 8, 2014 Author Share Posted December 8, 2014 Thanks LeJack and QuickOldCar. My PHP adventure begins now. See y'all around. Quote Link to comment https://forums.phpfreaks.com/topic/292956-php-isnt-working-with-apache-webserver/#findComment-1498949 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.