Apache, PHP on 18.1

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
rgdot
Level 1
Level 1
Posts: 4
Joined: Mon Feb 06, 2017 2:59 pm

Apache, PHP on 18.1

Post by rgdot » Mon Feb 06, 2017 3:24 pm

Have been on 17.3 and Apache, PHP, MySQL all working well, kind of slow but that's another issue I guess.

Created a new partition to play with 18.1 Cinnamon, but can't get Apache, PHP to work, just blank white page with nothing in error logs that I can see. Have verified and tried many things which I will try to list below, googling the issues seems Ubuntu 16.04 (and 18.1) has problems with PHP.

I hope to get ideas here. Any help appreciated

Verified things are running:

Code: Select all

reza@reza-ThinkPad-T420 ~ $ php -v
PHP 7.0.12-1+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.12-1+deb.sury.org~trusty+1, Copyright (c) 1999-2016, by Zend Technologies

Code: Select all

reza@reza-ThinkPad-T420 ~ $ mysql -V
mysql  Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using  EditLine wrapper

Code: Select all

reza@reza-ThinkPad-T420 ~ $ service apache2 status
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Mon 2017-02-06 14:10:54 EST; 2min 49s ago
As mentioned I have tried and checked many things like making sure php/apache mods are loaded and updated, restarting Apache after every change too, for example this and others for cli, and others

Code: Select all

reza@reza-ThinkPad-T420 ~ $ sudo apt-get install libapache2-mod-php7.0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libapache2-mod-php7.0 is already the newest version (7.0.15-1+deb.sury.org~xenial+1).
0 upgraded, 0 newly installed, 0 to remove and 18 not upgraded.
Plus coming along other things in searches:

sudo a2dismod mpm_event
sudo a2enmod mpm_prefork

and yet more others like editing 000-default.conf and php.ini to change paths and error reporting lines. Nothing helps.

User avatar
phd21
Level 19
Level 19
Posts: 9034
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Apache, PHP on 18.1

Post by phd21 » Mon Feb 06, 2017 4:57 pm

Hi "rgdot",

Welcome to the wonderful world of Linux Mint and its excellent forum !

It would help to know more about your system setup. If you run "inxi -Fxzd" from the console terminal prompt, highlight the results, copy and paste them back here, that should provide enough information.


Perhaps these links will help you to install and run "LAMP" on LinuxMiknt 18.

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 16.04
https://www.digitalocean.com/community/ ... untu-16-04

Install LAMP on Ubuntu 16.04
https://www.linode.com/docs/websites/la ... untu-16-04

How To Install LAMP Stack On Ubuntu 16.04
https://www.unixmen.com/how-to-install- ... ntu-16-04/

Ubuntu 16.04 LAMP server tutorial with Apache 2.4, PHP 7 and MariaDB (instead of MySQL)
https://www.howtoforge.com/tutorial/ins ... 6-04-lamp/

Hope this helps ...
Phd21: Mint KDE 18.3 & 19, 64-bit Awesome OS, Ancient Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram,256gb SDD, Video: Intel 4 Graphics, DVD Lightscribe. Why I use KDE?:https://opensource.com/life/15/4/9-reasons-to-use-kde

rgdot
Level 1
Level 1
Posts: 4
Joined: Mon Feb 06, 2017 2:59 pm

Re: Apache, PHP on 18.1

Post by rgdot » Mon Feb 06, 2017 5:32 pm

Hi thanks for replying.

I am fairly certain they are all installed as they should be, as you can see in my first post, Apache, php and MySQL are certainly running and Apache example page works as well.

The only thing from your links I haven't done so far is the virtualhost configuration in the second link, which is just for using example.com I believe, not really needed. There is an issue post install, can't figure it out.

Here's the inxi -Fxzd output:

Code: Select all

System:    Host: reza-ThinkPad-T420 Kernel: 4.4.0-53-generic x86_64 (64 bit gcc: 5.4.0)
           Desktop: Cinnamon 3.2.7 (Gtk 3.18.9-1ubuntu3.1)
           Distro: Linux Mint 18.1 Serena
Machine:   System: LENOVO (portable) product: 4177R3U v: ThinkPad T420
           Mobo: LENOVO model: 4177R3U
           Bios: LENOVO v: 83ET67WW (1.37 ) date: 11/28/2011
CPU:       Dual core Intel Core i5-2430M (-HT-MCP-) cache: 3072 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 9569
           clock speeds: max: 3000 MHz 1: 988 MHz 2: 928 MHz 3: 917 MHz
           4: 927 MHz
Graphics:  Card: Intel 2nd Generation Core Processor Family Integrated Graphics Controller
           bus-ID: 00:02.0
           Display Server: X.Org 1.18.4 drivers: intel (unloaded: fbdev,vesa)
           Resolution: 1366x768@60.10hz
           GLX Renderer: Mesa DRI Intel Sandybridge Mobile
           GLX Version: 3.0 Mesa 11.2.0 Direct Rendering: Yes
Audio:     Card Intel 6 Series/C200 Series Family High Definition Audio Controller
           driver: snd_hda_intel bus-ID: 00:1b.0
           Sound: Advanced Linux Sound Architecture v: k4.4.0-53-generic
Network:   Card-1: Intel 82579LM Gigabit Network Connection
           driver: e1000e v: 3.2.6-k port: 5080 bus-ID: 00:19.0
           IF: enp0s25 state: down mac: <filter>
           Card-2: Intel Centrino Wireless-N 1000 [Condor Peak]
           driver: iwlwifi bus-ID: 03:00.0
           IF: wlp3s0 state: up mac: <filter>
Drives:    HDD Total Size: 500.1GB (2.1% used)
           ID-1: /dev/sda model: ST9500420AS size: 500.1GB
           Optical: /dev/sr0 model: Optiarc DVD RW AD-7710H
           rev: 1.S0 dev-links: cdrom,cdrw,dvd,dvdrw
           Features: speed: 24x multisession: yes
           audio: yes dvd: yes rw: cd-r,cd-rw,dvd-r,dvd-ram state: running
Partition: ID-1: / size: 184G used: 6.2G (4%) fs: ext4 dev: /dev/sda6
           ID-2: swap-1 size: 4.17GB used: 0.00GB (0%) fs: swap dev: /dev/sda5
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 37.0C mobo: N/A
           Fan Speeds (in rpm): cpu: 0
Info:      Processes: 277 Uptime: 2:16 Memory: 862.1/3834.2MB
           Init: systemd runlevel: 5 Gcc sys: 5.4.0
           Client: Shell (bash 4.3.461) inxi: 2.2.35 

User avatar
phd21
Level 19
Level 19
Posts: 9034
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Apache, PHP on 18.1

Post by phd21 » Mon Feb 06, 2017 6:23 pm

Hi "rgdot",

You are welcome.

I always install LAMP on my systems anyway as well. I do not see any problems or issues with the results of the "inxi -Fxzd" command.

I have a recently installed Linux Mint 18.1 KDE system (64-bit). After replying to your post, I literally just went through installing LAMP on my system using the information from those links.

My PHP and phpMyAdmin are working fine. You can tell the instructions are almost identical in all the installation links, except where adding more security, the PHP code optimizer, and adding more PHP options.

I use a combination of instructions from those links because I want to make everything more secure, to also install the MySQL client, and to use "phpMyAdmin", and install the PHP code optimizer (for speed) (sudo apt-get install php-apcu) before installing other extra PHP packages. Tip: do not run (sudo mysql_secure_installation) until after installing everything including PHP packages, or it will probably not let you create the PHP database, or select the option "0" for MySQL secure passwords temporarily, you can then re-run it afterwards to force stronger passwords.

It will not hurt anything to go through the steps again, you will see where they have nice tutorials and small test apps to test your php. In my browser I use:

To access the webserver
http://localhost

Created and ran a PHP test per instructions in the links using
http://localhost/testphp.php

Ran phpMyAdmin
http://localhost/phpmyadmin/

Hope this helps ...
Phd21: Mint KDE 18.3 & 19, 64-bit Awesome OS, Ancient Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram,256gb SDD, Video: Intel 4 Graphics, DVD Lightscribe. Why I use KDE?:https://opensource.com/life/15/4/9-reasons-to-use-kde

rgdot
Level 1
Level 1
Posts: 4
Joined: Mon Feb 06, 2017 2:59 pm

Re: Apache, PHP on 18.1

Post by rgdot » Mon Feb 06, 2017 6:29 pm

Thanks again, will attempt a reinstall based on your links and what you posted.

rgdot
Level 1
Level 1
Posts: 4
Joined: Mon Feb 06, 2017 2:59 pm

Re: Apache, PHP on 18.1

Post by rgdot » Thu Feb 09, 2017 4:35 pm

After 2 more attempts of using Apache, php, mysql on a freshly (re)installed 18.1 I gave up and instead installed XAMPP linux edition, XAMPP works fine on 18.1.

If I figure out what's up, comparing XAMPP config files with manually installed config files, will post again. Thanks phd21.

steve_dub
Level 1
Level 1
Posts: 3
Joined: Sun Feb 12, 2017 9:46 am

Re: Apache, PHP on 18.1

Post by steve_dub » Sun Feb 12, 2017 10:25 am

Try running these commands for the installation, everything should work right after install:

Code: Select all

sudo apt-get update && sudo apt-get dist-upgrade -y
sudo apt-get install lamp-server^ -y
This work for my home server with no issues on Linux Mint 18.1.

User avatar
wutsinterweb
Level 5
Level 5
Posts: 692
Joined: Tue Feb 28, 2017 2:14 am
Location: Connecticut, USA

Re: Apache, PHP on 18.1

Post by wutsinterweb » Fri Jul 14, 2017 1:45 pm

Code: Select all

Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.7_5.7.18-0ubuntu0.16.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
wutsinterweb@Beast-Wutsinterweb ~ $ sudo mysql_secure_installation
sudo: mysql_secure_installation: command not found
wutsinterweb@Beast-Wutsinterweb ~ $ 
I'm just a student, your guidance is appreciated.

pastic
Level 2
Level 2
Posts: 94
Joined: Thu Jun 16, 2016 11:50 am

Re: Apache, PHP on 18.1

Post by pastic » Sat Jul 15, 2017 10:33 am

Hi!
I went through some frustrating moments to get the LAMP components installed and working when I first tried (on 17.3). So I ended up writing a bash script when I got a configuration that worked for me. FWIW, this below is the install script I use whenever I do a fresh install. It currently works flawlessly on 18.1 Cinnamon on my machine.

It contains a bit of fluff (color codes and Wordpress stuff, but you can just lock out and delete those parts).

Not that I am an apache hero, I am just posting it in case it is of any help.

Code: Select all

#!/bin/sh

#install LAMP och PHPmyAdmin - testat i Mint 18.1 (lamp och mysql kommer att starta automatiskt vid boot)
tput setaf 7 && 
sudo apt-get install apache2 &&
sudo apt-get install libapache2-mod-php &&
sudo a2enmod rewrite &&
sudo apt-get install php-xdebug &&
echo "" &&
tput setaf 190; echo "Now, find <Directory /var/www/> and set AllowOverride to All (otherwise, changing permalinks will break the site). Also, if your web files are on a data partition the corresponding <Directory> block needs to be created for that location." &&
sudo xed /etc/apache2/apache2.conf &&
tput setaf 7; sudo /etc/init.d/apache2 restart &&

#verify apache2 and php installation
sudo sh -c 'echo "<?php phpinfo() ?>" > /var/www/html/phpinfo.php' &&
xdg-open http://localhost/phpinfo.php &&

#mysql and phpmyadmin
sudo apt-get install mysql-server &&
sudo apt-get install mysql-client &&
sudo apt-get install php7.0-mysql php7.0-curl php7.0-json &&
sudo apt-get install phpmyadmin &&

#increase php upload size (for Wordpress)
tput setaf 190; echo "Now set 32M for upload_max_filesize och post_max_size" &&
sudo xed /etc/php/7.0/apache2/php.ini &&
tput setaf 7; sudo service apache2 restart &&

#just testing...
echo "" &&
tput setaf 190; echo "Print PHP version and MySQL status..." &&
tput setaf 7; php -v &&
sudo systemctl status mysql &&

#verify that phpmyadmin works
xdg-open http://localhost/phpmyadmin &&

#SET PROPER PERMISSIONS - only works if 'peter' is current username
#sets the group owndership of all files in /var/www to "www-data" recursively
sudo chown -R www-data: /var/www &&
#allows everyone (including apache) to read all files in /var/www
sudo chmod -R o+r /var/www &&
#allows group members to write to all files in /var/www
sudo chmod -R g+w /var/www &&
#sets new files to retain the group of the directory they are created in
sudo find /var/www -type d -exec chmod g+s {} \; &&
#add user 'peter' to www-data
sudo usermod -a -G www-data peter &&
tput setaf 190; echo "Setting proper permissions for /var/www/" &&
echo "User peter has now joined group www-data. Log out and in again for permissions to take effect. N.B. if the user to join www-data was someone else, do it manually or adapt script. Furthermore, if using a symlinked data partition for web files, the permissions commands from the script need to be issued manually for the data partition as well."
Mint 19
Asus Sabertooth x58 ~ i7 950 ~ Radeon HD 7750
"Do you respect wood?" (Larry David)

User avatar
Taffman
Level 3
Level 3
Posts: 133
Joined: Fri May 06, 2011 10:51 am
Location: United Kingdom
Contact:

Re: Apache, PHP on 18.1

Post by Taffman » Fri Oct 06, 2017 4:42 am

Thanks for this, you helped me fix a cURL problem I had with my new LAMP install :D
Linux Mint KDE 18.1 Plasma 64-bit, Dell Dimension 9200, 4GB, 2.4GHz Core2, Radeon X1300

Post Reply

Return to “Software & Applications”