Question

PHP 7.0 short_open_tag won't enable when changed in php.ini. Required to setup software I want to use.

I’m trying to setup a web application that requires short_open_tag to be enabled in order to continue through the install wizard. I have set it to

short_open_tag=On

in php.ini, but it still shows off in phpinfo, adn the software wizard also sees it as disabled. I’m using PHP 7.0 and Apache2.

Show comments

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
June 12, 2023
Pinned Answer

Heya,

In cases like this, usually there are a couple of stuff to check.

It seems like the changes to your php.ini file are not being recognized. Here are a few steps to troubleshoot this issue:

  1. Check if you are editing the correct php.ini file: You might have multiple php.ini files on your system. To make sure you are editing the correct one, create a simple PHP script with <?php phpinfo(); ?>, run it in your browser and look for “Loaded Configuration File”. This is the php.ini file that is being used. Make sure to edit this file.

  2. Check for syntax errors: Make sure that the line you added doesn’t have any syntax errors and isn’t conflicting with any other lines. If there is a short_open_tag entry already, it might be overriding your entry. Also, ensure the line is not commented out (should not have a semi-colon ; at the beginning).

  3. Restart the Apache service: After making changes to the php.ini file, you need to restart the Apache service for the changes to take effect. You can do this by running sudo systemctl restart apache2 or sudo service apache2 restart, depending on your system.

If you use nginx you should restart fpm

sudo service php7.0-fpm restart

not a nginx server. Maybe I will save someone time)

In your home directory, create a file called info.php.

In that file, put in the following: <?php phpinfo(); ?>

Then run it in your browser, look for “Loaded Configuration File”. It should give you a path like /etc/php5/apache2/php.ini. That’s the file you need to edit. Then restart apache.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel