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
AXISHKAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
First you're using 'short_open_tag' which are "<?" instead of "<?php>.  They are turned off on many hosting companies.
http://php.net/manual/en/ini.core.php#ini.short-open-tag
0
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
first possibilities:

1. check if php is installed properly in web server? you can test it by writing a simple php page with:

<?php phpinfo(); ?>

Open in new window


2. do you using short open tag of <? ... ?> ? if yes, then check in your php.ini and see if short_open_tag setting is turned on?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AXISHKAuthor Commented:
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
0
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
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.
1
AXISHKAuthor Commented:
Reboot but it doesn't help. There is only one php.ini on the server.

Thx
0
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
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.
0
ste5anSenior DeveloperCommented:
Well, there is a semicolon missing...

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

Open in new window

Is missing a ';' on the end and you probably have errors turned off.
1
Dan CraciunIT ConsultantCommented:
With phpinfo you can see:
1. if short_open_tag is On or not
2. the location of php.ini loaded by the server: "Loaded Configuration File"

2017-11-29-11_40_13-phpinfo--.png
2017-11-29-11_39_38-phpinfo--.png
HTH,
Dan
0
Chris StanyonWebDevCommented:
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.
1
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
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.
0
kenfcampCommented:
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
0
AXISHKAuthor Commented:
Thx.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.