configure the php.ini on vagrant homestead

ぃ、小莉子 提交于 2020-01-22 05:40:11

问题


I want to allow short_open_tags in php.ini

I want to access to the php.ini on my vagrant box configured with homestead. I saw the php.ini file in /etc/php5/fpm/php.ini

But ... permission denied Is somebody knows ?

Thanks


回答1:


Here is how you grant read/write access to php.ini, modify it, save changes & reload nginx:

1. Navigate to folder containing php.ini: $ cd /etc/php5/fpm

2. Grant read/write access: $ sudo chmod -R ugo+rw php.ini

3. Open php.ini: $ vim php.ini

4. Enter edit mode: $ i

5. Edit stuff

6. Exit edit mode: Press ESC

7. Save & close php.ini: $ :x!

7.1 OPTIONAL: Exit without saving: $ :q

8. Navigate to home (not sure if this is actually necessary): $ cd ~

9. Reload/Restart nginx: $ sudo nginx -s reload

10.1 Reload/Restart php: $ sudo service php5-fpm restart

10.2 If using PHP 7 then use $ sudo service php7.0-fpm restart (Thanks & Credit to Richard in comments).

11. ???

12. PROFIT! (or is that joke really too old?)

Here is a screenshot:

Remember if you run $ vagrant provision, it'll reset all configuration files. Just so you know.

EDIT

Super useful to know. You can search in vim by exiting input mode, and type $ /post_max_size or whatever you want to find.




回答2:


Just create ".user.ini" file (.user.ini files) in public/

[PHP]
short_open_tag = On



回答3:


I have tried to change the mentioned php.ini for over an hour.
I suggest to check first which php.ini is really loaded.
I have checked it with php -i.

In my case it was located in /etc/php/7.2/cli.




回答4:


Simply ssh in to the homestead environment:

ssh homestead

Then become the superuser by typing:

sudo su

Then you will be able to edit your php.ini.




回答5:


Maybe you should use htaccess to this problem

If you dont have, make file .htaccess (with the dot in root) and write down

<IfModule mod_php5.c>
   php_value short_open_tag 1
 </IfModule>

Good hosting providers does not provide the enter into php.ini




回答6:


I had the same issue i solved it by opening php.ini file in root user mode otherwise you will not have permission to edit file....



来源:https://stackoverflow.com/questions/28275579/configure-the-php-ini-on-vagrant-homestead

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!