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.

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.

If you use nginx you should restart fpm

sudo service php7.0-fpm restart

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

Become a contributor for community

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

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.