apache2 - After lamp install, can't run php scripts on localhost - Ask Ubuntu
i followed tutorial install lamp: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu
at step 4: see php on server, told following:
first create new file:
> sudo nano /var/www/info.php
add in following line:
<?php phpinfo(); ?>
then,i should see page lots of information, when type in localhost/info.php
but page white. no error message.
if type in localhost/index
, apache2 ubuntu default page loads.
later, moved info.php /var/www/html
page still white.
at point, i'm clueless. suggestions fix problem?
first of all, rather create public_html folder in user's home directory
mkdir public_html
by default, php scripts in user directories disabled. in other words need enable them. instructions, seem have php5 installed. enable php scripts in user directories, edit /etc/apache2/mods-available/php5.conf file root.
in case did
sudo vim /etc/apache2/mods-available/php5.conf
when file open, comment out following lines (instructions inside file too)
<ifmodule mod_userdir.c> <directory /home/*/public_html> php_admin_value engine off </directory> </ifmodule>
and save it. make sure userdir enabled with
sudo a2enmod userdir
move info.php file public_html folder. restart apache2 with
sudo service apache2 restart
go http://localhost/~yourusername/info.php , should work perfectly.
Comments
Post a Comment