Error migrating moodle (moodle only shows source code)

Error migrating moodle (moodle only shows source code)

by Aldi Rauf -
Number of replies: 10

I'm migrating my moodle, its version is 3.4.2, and I'm using php 7.0 (already tried using 7.1, 7.2 and 7.3) and apache 2.2

I already configure the config.php following the setting of the migration directory, dbname, dbusers, password and all, but when I try to access the moodle, it turned out to only show the source code

Here's is the source code shown when I tried to acces the moodle 

source code


How can I solve this problem?

Any help will be really apreciated. Thank you.

 

 


Average of ratings: -
In reply to Aldi Rauf

Re: Error migrating moodle (moodle only shows source code)

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
In reply to Visvanath Ratnaweera

Re: Error migrating moodle (moodle only shows source code)

by Aldi Rauf -

Thank you for the reply. 

I tried to create the info.php but when I tried to access the info.php, it turned out to be blank. 

In reply to Aldi Rauf

Re: Error migrating moodle (moodle only shows source code)

by Ken Task -
Picture of Particularly helpful Moodlers

Doesn't look like the server you migrated the code to + data directory + import of sql dump to DB server has php fully functional and talking to apache.

What platform?   Linux?  What flavor (ubuntu/centOS/other)?  Remotely hosted?   Hosting provider?

From an ssh shell, what do you get when issuing:

httpd -V

or if Ubuntu

apache2 -V

Create a phpinfo page ... then hit the php info page with browser.

'spirit of sharing', Ken



In reply to Ken Task

Re: Error migrating moodle (moodle only shows source code)

by Aldi Rauf -

I installed the moodle on VPS

It's the result when I access httpd -V


ttpd -V

Server version: Apache/2.2.34 (Unix)

Server built:   Feb 28 2019 16:58:19

Server's Module Magic Number: 20051115:43

Server loaded:  APR 1.5.2, APR-Util 1.5.4

Compiled using: APR 1.5.2, APR-Util 1.5.4

Architecture:   64-bit

Server MPM:     Prefork

  threaded:     no

    forked:     yes (variable process count)

Server compiled with....

 -D APACHE_MPM_DIR="server/mpm/prefork"

 -D APR_HAS_SENDFILE

 -D APR_HAS_MMAP

 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)

 -D APR_USE_SYSVSEM_SERIALIZE

 -D APR_USE_PTHREAD_SERIALIZE

 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT

 -D APR_HAS_OTHER_CHILD

 -D AP_HAVE_RELIABLE_PIPED_LOGS

 -D DYNAMIC_MODULE_LIMIT=128

 -D HTTPD_ROOT="/usr/local/apps/apache"

 -D SUEXEC_BIN="/usr/local/apps/apache/bin/suexec"

 -D DEFAULT_PIDLOG="logs/httpd.pid"

 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"

 -D DEFAULT_LOCKFILE="logs/accept.lock"

 -D DEFAULT_ERRORLOG="logs/error_log"

 -D AP_TYPES_CONFIG_FILE="etc/mime.types"

 -D SERVER_CONFIG_FILE="etc/httpd.conf"

In reply to Aldi Rauf

Re: Error migrating moodle (moodle only shows source code)

by Ken Task -
Picture of Particularly helpful Moodlers

VPS with a provider? or VPS on a local server running what for a VM?

Some more commands:

uname -an

For a server that's to be running a Moodle ... and am guessing RedHat or similar family of guest OS, this path to document root: /usr/local/apps/apache is a very strange place.

What other directories or files do you have in /etc/httpd/

Change into that directory:

cd /etc/httpd/

and issue:

find ./ -name php.conf

to see if one has mod_php installed.

What are you following (tutorial/doc) to install what's typically called 'LAMP' ... Linux/Apache/MySQL/PHP.

'spirit of sharing', Ken


In reply to Ken Task

Re: Error migrating moodle (moodle only shows source code)

by Aldi Rauf -

This is the result of the code


[root@vps589861 httpd]# uname -an

Linux vps589861.local 3.10.0 #1 SMP Sun Oct 28 10:57:35 MSK 2018 x86_64 x86_64 x86_64 GNU/Linux

[root@vps589861 httpd]# cd /etc/httpd

[root@vps589861 httpd]# find ./ -name php.conf

./conf.d/php.conf

[root@vps589861 httpd]#



What does it mean?? 



I already tried to make info.php file which code is phpinfo(), but it only shows blank page.

In reply to Aldi Rauf

Re: Error migrating moodle (moodle only shows source code)

by Ken Task -
Picture of Particularly helpful Moodlers

What does it mean?

The response from 'uname -an' gives a response I've never seen before ... the "MSK" in it indicates your VM is not of any mainstream distro of Linux with which I am familiar. 

A linux container LXC, LXD and LXCFS????

More evidence of strangeness ....

Linux vps589861.local 3.10.0 # ...  a .local directory for a kernel?!!!??

That's why I asked about where the VPS is hosted ... with a provider?   If so, what provider?

The 'find' response does show a php.conf file which is normally present when mod_php has been installed.  So that's kinda a good sign.

Now more commands please:

yum repolist

RedHat Family servers use yum as package manager (enables you to install/un-install software).

ps aux |grep httpd

ps aux |grep mysql

php -v

php -m

I also asked if you were following any doc/tutorial etc. for installing LAMP ... Linux/Apache/MySQL/PHP ... are you?   IF so, URL please.

'spirit of sharing', Ken


In reply to Ken Task

Re: Error migrating moodle (moodle only shows source code)

by Aldi Rauf -

I got the VPS from niagahoster


This is the result from the commands


Last login: Tue Apr  2 07:45:59 2019 from 103.119.66.1

[root@vps589861 ~]# yum repolist

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: ftp.man.poznan.pl

 * epel: mirror.imt-systems.com

 * extras: ftp.hosteurope.de

 * updates: ftp.man.poznan.pl

repo id              repo name                                    statusSoftaculous/7/x86_64 Virtualizor Repo                                 9

base/7/x86_64        CentOS-7 - Base                              10019

*epel/x86_64         Extra Packages for Enterprise Linux 7 - x86_ 13030

extras/7/x86_64      CentOS-7 - Extras                              385

updates/7/x86_64     CentOS-7 - Updates                            1487

repolist: 24930

[root@vps589861 ~]# ps aux | grep httpd

root      4907  0.0  0.0 114648  3440 ?        Ss   07:28   0:00 /usr/local/apps/apache/bin/httpd -k start

apache    4910  0.0  0.0 114780  3280 ?        S    07:28   0:00 /usr/local/apps/apache/bin/httpd -k start

apache    4911  0.0  0.0 114960  3356 ?        S    07:28   0:00 /usr/local/apps/apache/bin/httpd -k start

apache    4936  0.0  0.0 114960  3668 ?        S    07:28   0:00 /usr/local/apps/apache/bin/httpd -k start

apache    4937  0.0  0.0 115280  3640 ?        S    07:28   0:00 /usr/local/apps/apache/bin/httpd -k start

apache    4938  0.0  0.0 114976  3500 ?        S    07:28   0:00 /usr/local/apps/apache/bin/httpd -k start

apache    9021  0.0  0.0 115088  3800 ?        S    07:46   0:00 /usr/local/apps/apache/bin/httpd -k start

root     20928  0.0  0.0   9092   672 pts/0    S+   08:38   0:00 grep --color=auto httpd

[root@vps589861 ~]# ps aux | grep mysql

root      4627  0.0  0.0  11816  1216 ?        S    Mar27   0:00 /bin/sh /usr/local/apps/mysql56/bin/mysqld_safe --defaults-file=/usr/local/apps/mysql56/etc/my.cnf --basedir=/usr/local/apps/mysql56 --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/mysqld.pid --innodb

mysql     4818  0.0 16.5 1781476 693316 ?      Sl   Mar27   2:52 /usr/local/apps/mysql56/bin/mysqld --defaults-file=/usr/local/apps/mysql56/etc/my.cnf --basedir=/usr/local/apps/mysql56 --datadir=/var/lib/mysql --plugin-dir=/usr/local/apps/mysql56/lib/plugin --user=mysql --innodb --log-error=/var/log/mysqld.log --pid-file=/var/lib/mysql/mysqld.pid --socket=/var/lib/mysql/mysql.sock

root     20930  0.0  0.0   9092   672 pts/0    S+   08:38   0:00 grep --color=auto mysql

[root@vps589861 ~]# php -v

PHP 5.4.16 (cli) (built: Oct 30 2018 19:30:51)

Copyright (c) 1997-2013 The PHP Group

Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

[root@vps589861 ~]# php -m

[PHP Modules]

bz2

calendar

Core

ctype

curl

date

ereg

exif

fileinfo

filter

ftp

gd

gettext

gmp

hash

iconv

json

libxml

mhash

openssl

pcntl

pcre

Phar

readline

Reflection

session

shmop

SimpleXML

sockets

SPL

standard

tokenizer

xml

zip

zlib


[Zend Modules]


[root@vps589861 ~]#


And about the tutorial, the provider, niagahoster gave me some kind of web manager called Webuzo, there I can install apache and php just by chosing the version, click install and everything's ready

In reply to Aldi Rauf

Re: Error migrating moodle (moodle only shows source code)

by Aldi Rauf -

SOLVED!!!!

I installed the 2.4 version of apache, and then it WORKED!!


Thank you so much Mr. Task for all the help and advices. 

In reply to Aldi Rauf

Re: Error migrating moodle (moodle only shows source code)

by Ken Task -
Picture of Particularly helpful Moodlers

Glad it's working!  Was about out of ideas to help!!!!

Some cautions now:
I see Softaculous.  Is that how you installed Moodle?
Moodle isn't and never has been an app one installs once and forgets it.
It will (sooner or later) *require* update or upgrade.
Softac doesn't have a good reputation in these forums for updates nor upgrades.
So ... learn how to do a full site backup from command line.  Learn that regardless of how Moodle installed.

PHP 5.4.6 has reached end of life.  No more fixes/patches.
Depending upon the version of Moodle, one needs to be running at least 7.1 of php.
(What is the version of Moodle?  Noifications in Moodle)

MySQL 56 is also old.

The good new is your server is based on CentOS 7 and uses those repos.

Suggest going to Moodle login as admin then go to Server Environment.
Update component.  Then see what the environment check says about system.

'spirit of sharing', Ken