I'M trying to learn php and I use Mint Linux as my OS. I don't know if php is installed or not. I went to synaptic package manager and input php, I got back a big list of php-xyz packages and I dont' know which one to get. Any suggestions?

Recommended Answers

All 8 Replies

you want to make sure you have apache as well.
run these at your terminal

sudo apt-get install apache2

sudo apt-get install php5

sudo apt-get install libapache2-mod-php5

sudo /etc/init.d/apache2 restart
commented: Better to use the one line command. -3
commented: for me instead this is good, because it's more flexible and gives the user the ability to choose what to install ;D +9

@Garret85 to check if PHP is installed type php -v in the terminal, you will get the version. Bye!

Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/php5/php5-common_5.3.10-1ubuntu3.2_amd64.deb 404 Not Found [IP: 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/php5/libapache2-mod-php5_5.3.10-1ubuntu3.2_amd64.deb 404 Not Found [IP: 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/php5/php5_5.3.10-1ubuntu3.2_all.deb 404 Not Found [IP: 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/php5/php5-cli_5.3.10-1ubuntu3.2_amd64.deb 404 Not Found [IP: 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Thanks, it seems to me working now. What directory whoud I place my html & php files in for apache?

Nevermind, I found it.

This is what I do, I create a directory inside /var/www:

mkdir /var/www/mysite

there I will paste all the files, then I make a copy of /etc/apache2/sites-available/default file

cd /etc/apache2/sites-available
sudo cp default mysite

and go to edit this file by:

  • adding a ServerName
  • change DocumentRoot
  • change AllowOverride from None to All otherwise the .htaccess file will be ignored
  • change <Directory /var/www> to point directly to the location of the website directory, so: <Directory /var/www/mysite>

as suggestion check apache manual to understand how to edit the config file:


the entire file will be:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName mysite.local

    DocumentRoot /var/www/mysite
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    <Directory /var/www/mysite>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from ::1/128


then save the file, and back to the terminal run this command:

sudo a2ensite mysite

this enables the site, in order to disable use sudo a2dissite mysite and go to edit **hosts* file:

sudo nano /etc/hosts

inside the hosts file paste:   mysite.local

this is going to match the ServerName variable inside the configuration file, then reload the server:

sudo service apache2 reload

and you are finished, just point your browser to http://mysite.local/

Ops, just saw you've solved.. bye!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.