Link to home
Start Free TrialLog in
Avatar of AXISHK
AXISHK

asked on

PHP / MySQL / Apache problem

After moving the php application on another server, I find that a lot of php coding cannot run. Attached is a simple test. Any idea ?
C--temp-Test1.png
C--temp-Test2.txt
SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AXISHK
AXISHK

ASKER

PHP Info work perfect. I have also test mySQL and can access the tables through SQL statement.

The tag has been on in php.ini

short_open_tag = on
The tag has been on in php.ini

short_open_tag = on
Make sure you edited the correct php.ini? (just in case you got many instances of php.ini in multiple locations)

A reboot for your web server may also need to reflect the changes.
Avatar of AXISHK

ASKER

Reboot but it doesn't help. There is only one php.ini on the server.

Thx
I don't have Apache Web Server with me so I can't simulate your issue, but I got tested this with IIS by turning on/off short_open_tag in php.ini and it showed me different result after I made such changes.
Well, there is a semicolon missing...

btw, instead of attaching files, please embed code and images in future posts.. increases readability..
echo '<p>Hello World !! </p>'

Open in new window

Is missing a ';' on the end and you probably have errors turned off.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
On a side note:

Whilst you may not have a problem yet, you will have pretty soon and your code will fail to work entirely. You are using the old mysql* extension. This was deprecated in PHP 5.5 and completely removed in 7. If your host upgrades your PHP version, your app will fail.

Make the switch to mysqli or PDO as soon as possible.
Ryan asked his question, about correct php.ini file, then reading your other comments it does appear you're editing the wrong php.ini file.

Try this set of commands...

updatedb
locate php.ini

Open in new window


This will locate all php.ini files on your machine.

Then when you think you've found the correct file, you must make sure (never, ever guess) + here's how.

I'll guess that you turned up php.ini files in /etc + /usr/local/etc, so you'd modify this command to match all the toplevel directories where you find php.ini files in your runtime environment.

# In window #1
inotifywait -mrq /etc /usr/local/etc | grep php.ini

# In window #2 do a hard restart of PHP, which will be one of these commands.
# If you run FPM change 7.1 to your version. Likely your Distro version is to old for FPM.

service apache2 restart
service httpd restart
service php7.1-fpm restart

Open in new window


When you issue the restart in Window #2 you'll see each *actual* php.ini file used get listed in Window #1.

_______

To expand on what Chris said...

If you're running mysql_*() rather than mysqli_*() then you're likely running PHP-5.5 or below. All these versions have publicly publishes hacks, which will never be fixed, because all pre-5.6 versions have reached EOL (End of Life).

Worse, an OS which contains PHP-5.5 in it's packaging likely contains a very old Kernel, many of which are effected by a zero day exploit, which has been fixed in recent Kernels.

I'd suggest you first install a recent OS version. I run Ubuntu Zesty for all my hosting clients. Zesty runs Kernel 4.10 (secure, no zero days yet) + PHP versions 5.6 + 7.0 + 7.1 + 7.2 which may be installed together + toggled between to test compatibility.

Start with a solid hosting environment + then start debugging your code.
Try adding :

<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');

?>

to the top of one of the files (scripts) being accessed and see if it gives you anything useful
Avatar of AXISHK

ASKER

Thx.