I'm making a website and I've set up a mysql database on my apache2 server. I tried to get the 'create account' feature working and it has horribly failed. I saw a YouTube video tutorial on this and I used the code (which worked in the tutorial). When I tested it in the browser, all the php code showed up as plain text in the page. I checked the PHP tags, and they are all in the proper position. I tried this code in both a '.php' file and a '.html' file.
Anyone know why it's not working?
PHP not working (apache2 server)
Page 1 of 18 Replies - 1504 Views - Last Post: 09 August 2012 - 03:38 PM
Replies To: PHP not working (apache2 server)
#2
Re: PHP not working (apache2 server)
Posted 08 August 2012 - 10:44 PM
did you register .php files to be handled by the PHP interpreter in the Apache configuration?
#3
Re: PHP not working (apache2 server)
Posted 09 August 2012 - 01:15 AM
My advice is to uninstall both Apache & MySQL, and then download and install Wamp 2 Server (it's a great tool for beginners and you don't have to worry about configuration). After that go to www directory, delete those files and put your website instead (be carefull your website is running as long as your Wamp server is running).
Or if you're more a youtube guy check this video on how to install Wamp server (note: he is making a new folder instead of deleting all the files in www, you can do that too if you want to access the phpmyadmin via Wamp's homepage).
PHP code works only in .php files located on a server.
Or if you're more a youtube guy check this video on how to install Wamp server (note: he is making a new folder instead of deleting all the files in www, you can do that too if you want to access the phpmyadmin via Wamp's homepage).
kwimble, on 09 August 2012 - 07:41 AM, said:
I tried this code in both a '.php' file and a '.html' file.
PHP code works only in .php files located on a server.
#4
Re: PHP not working (apache2 server)
Posted 09 August 2012 - 08:09 AM
#5
Re: PHP not working (apache2 server)
Posted 09 August 2012 - 08:12 AM
Okay let's back up.. what OS is this installed on? Are you using something like WAMP/XAMPP/LAMP?
Is the apache server running right? What happens when you open a browser to "localhost"?
Is the apache server running right? What happens when you open a browser to "localhost"?
#6
Re: PHP not working (apache2 server)
Posted 09 August 2012 - 09:01 AM
This question has nothing to do with the php language, & was even specified in the topic as an Apache error.
Moving topic to Web Servers & Hosting.
Under httpd.conf you need to add the php file type :
AddType application/x-httpd-php .php
& you have to load your php module so file.
Once you've done both of these, restart your apache server.
For future reference, YouTube tutorials make for poor reference points. I suggest you read Apache's documentation, since they wrote the service.
Moving topic to Web Servers & Hosting.
kwimble, on 09 August 2012 - 01:41 AM, said:
When I tested it in the browser, all the php code showed up as plain text in the page
Under httpd.conf you need to add the php file type :
AddType application/x-httpd-php .php
& you have to load your php module so file.
Once you've done both of these, restart your apache server.
For future reference, YouTube tutorials make for poor reference points. I suggest you read Apache's documentation, since they wrote the service.
#7
Re: PHP not working (apache2 server)
Posted 09 August 2012 - 09:33 AM
modi123_1, on 09 August 2012 - 08:12 AM, said:
Okay let's back up.. what OS is this installed on? Are you using something like WAMP/XAMPP/LAMP?
Is the apache server running right? What happens when you open a browser to "localhost"?
Is the apache server running right? What happens when you open a browser to "localhost"?
The apache2 server is installed on Ubuntu. It says "can't connect to server" when I search ' http://localhost/ ' in the url.
#8
Re: PHP not working (apache2 server)
Posted 09 August 2012 - 09:45 AM
At the command prompt type ps aux | grep httpd & make sure it's running.
#9
Re: PHP not working (apache2 server)
Posted 09 August 2012 - 03:38 PM
If it's not, service httpd start and make sure it's in init.d for startup as a daemon.
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote








|