16

I've upgraded from UBUNTU 13.04 to 13.10 but I can not work with PHP pages or phpmyadmin . I've tried this way to install lamp on Ubuntu sudo apt-get install lamp-server^ phpmyadmin and I've done all of the configuration correctly after installation I've added this line Include /etc/phpmyadmin/apache.conf to /etc/apache2/apache2.conf then I restarted apache2

Now I have two problems:

  1. In phpmyadmin on the bottom of the page is this error : The mcrypt extension is missing. Please check your PHP configuration I've check and mcrypt was in it , but in phpmyadmin it gives me error of missing .

  2. The other problem is on PHP pages it seems like there is no PHP and it's all html because lots of PHP lines are printed in textbox's like : <? echo $row['details']; ?> Can anybody tell me what should I do ?

8 Answers8

48

Try this for your mcrypt problem:

mv -i /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
sudo php5enmod mcrypt
sudo service apache2 restart

It's a bug with the location of the mcrypt.ini file, I got the info from here.

I had the same bug, I did a cp instead of a mv to be sure but it solved the problem.

For PHP not working, if you get phpmyadmin working (even with the mcrypt error), it means PHP is working (because phpmyadmin uses PHP). But in your example <? echo $row['details']; ?> change <? to <?php and try again?

Whatts
  • 596
  • 1
    thank you , your answer fixed all of my issues. ?> is not working any more ? in the newer version of php ? it has to be to work ? – Mohammad_Hosseini Oct 19 '13 at 22:43
  • I just googled it and it seems short tags are not active by default anymore. You can switch it back on, but it's best practice to always use <?php – Whatts Oct 20 '13 at 07:25
  • thanks in advance ,but still there is a bit of a problem , in some of my php pages I don't know what is the problem , when I try to load this pages just a white blanket page is showing, I've tried enabling error reporting for php on the top the page but still nothing shows on the page. this might not be a good place to ask this question but since I've brought this issue I asked again . if you need me to put some of the codes here tell me, thanks. – Mohammad_Hosseini Oct 20 '13 at 09:10
  • A completely white page usually means a missing bracket or semicolon. Or calling a function that doesn't exist. If you don't have a software development environment that can help you, try commenting out parts of your code one block at a time (start comments with /* and finish with */ , everything in between is commented out). I usually start with about half the code commented out and then try to display, then always narrowing down to where the error is). – Whatts Oct 20 '13 at 16:24
4

For the second problem about, lots of PHP lines are printed in textbox's like: echo $row['details'];

Edit your php.ini config file (for apache):

sudo nano -w /etc/php5/apache2/php.ini

and change:

short_open_tag = Off

to:

short_open_tag = On
Joren
  • 5,053
  • 8
  • 38
  • 54
moz667
  • 41
1

Check all your scripts under /etc/php5/conf.d/ because they will have stopped working. In my case, imap also stopped working.

Solved the problem with the symbolic link trick (as root):

ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/mcrypt.ini
php5enmod mcrypt
ln -s /etc/php5/conf.d/imap.ini /etc/php5/mods-available/imap.ini
php5enmod imap
service apache2 restart
1

(I would have posted this as a comment above but don't have the privileges.)

Whatts' intuition to use cp instead of mv was a good one. For example, if you are using the Laravel 4 framework, the artisan CLI will detect mcrypt.ini in /etc/php5/mods-available/, but the framework itself seems to look for it in /etc/php5/conf.d/. You need a copy of it in both locations for everything to work:

cp -i /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
sudo php5enmod mcrypt
sudo service apache2 restart
MHG
  • 137
  • 1
  • 5
0

Actually the right place for mcrypt.ini file is in mods-available directory not in conf.d. So replacing and enabling mcrypt configuration file, solves this problem.

hg8
  • 13,462
Navid
  • 26
0

In terminal(Ctrl+Alt+T)

1.open file php.ini :

/etc/php5/apache2$sudo nano php.ini

2.replace Off to On :

short_open_tag = On

3.restart apache :

sudo service apache2 restart
A J
  • 11,367
  • 17
  • 44
  • 59
Din
  • 1
-1

I also had a problem with mcrypt after installing Ubuntu 14.04. Following this link should help. www.php.net

  1. Open your php.ini file sudo gedit /etc/php5/apache2/php.ini
  2. Restart your apache2 sudo service apache2 restart

Hope this helps.

Daroath
  • 101
-1

Duplicated question: Mcrypt extension is missing in 14.04 server for mysql

Short answer:

sudo apt-get install mcrypt php5-mcrypt
sudo php5enmod mcrypt
sudo service apache2 restart
thucnguyen
  • 1,527