0

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?

4
Contributors
8
Replies
14
Views
5 Years
Discussion Span
Last Post by cereal
1

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
Votes + Comments
for me instead this is good, because it's more flexible and gives the user the ability to choose what to install ;D
Better to use the one line command.
1

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

Edited by cereal

0

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: 91.189.92.190 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: 91.189.92.190 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: 91.189.92.190 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: 91.189.92.190 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

0

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

0

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:

http://httpd.apache.org/docs/current/mod/core.html

the entire file will be:

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

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

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

    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 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

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:

127.0.0.1   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/

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

Edited by cereal

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.