Php Error Parsing /etc/php5/apache2/php.ini
communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Ask Ubuntu Questions Tags Users Badges Unanswered Ask Question _ Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Find the correct php.ini file up vote 91 down vote favorite 47 I am currently trying to locate the correct php.ini file to edit it and restart apache so the changes will take place and I'm stumped. What I have done... I have found three different php.ini files (no idea why there are three) this is how I found the files sudo find / -name php.ini It resulted in the following.... /etc/php5/cli/php.ini /etc/php5/apache2/php.ini /etc/php5/cgi/php.ini I also did.... sudo php -i | grep 'Configuration File' This showed.... Configuration File (php.ini) Path => /etc/php5/cli Loaded Configuration File => /etc/php5/cli/php.ini I changed all of them (just to be sure) to the settings I wanted. I restarted apache using sudo service apache2 restart The results... * Restarting web server apache2 I reloaded the page and it showed that the php.ini file was not updated. I know this becuase I used echo ini_get('post_max_size'); Which was suppose to be changed to 20M but was still only 2M I tried rebooting my computer thinking maybe that would legit stop the apache server and reload the php.ini file with the correct setting, but alas that attempt also failed. Is there any chance there could be another php.ini file that could be interfering? I'm at a loss and would love some help. Any and all help is very appreciated! apache2 php share|improve this question asked Oct 12 '13 at 0:19 Michael 558166 4 the 'correct' one is in the apache2 subdirectory –Joren Oct 12 '13 at 0:21 1 use updatedb; locate php.ini instead of find. –sjas Aug 13 '15 at 9:46 add a comment| 3 Answers 3 active oldest votes up vote 158 down vote accepted +250 The three files you have there are each meant for different uses. /etc/php5
Installation of a local PEAR copy on a shared host (Previous) Command line installer (PEAR) (Next) PEAR Manual Installation (PEAR) Introduction Getting and installingthe PEAR package manager Installation of a localPEAR copy on a sharedhost Checking if PEAR works Checking if PEAR works Verifying command line tool Both pear and pecl tools should be available everywhere on command line. For that to work, pear's binary (bin) directory should be in your PATH variable. To verify it works, simply type pear. A list of commands should be http://askubuntu.com/questions/356968/find-the-correct-php-ini-file shown: $pearCommands:buildBuildanExtensionFromCSourcebundleUnpacksaPeclPackagechannel-addAddaChannel... You should further test that PEAR is up to date: $pearversionPEARVersion:1.7.2PHPVersion:5.2.6RC4-pl0-gentooZendEngineVersion:2.2.0Runningon:Linux... Verifying the include path To use PEAR and PEAR compatible packages in your applications, you normally include them into your PHP scripts using require_once(). For this to work, PEAR's php_dir must be a part of PHP's include path. First, check where PEAR installs .php files: $pearconfig-getphp_dir/usr/share/lib/php/ https://pear.php.net/manual/en/installation.checking.php This directory will contain System.php. Now it's time to find which configuration file is used by your PHP installation. On command line, execute: $php--iniConfigurationFile(php.ini)Path:/etc/php/cli-php5LoadedConfigurationFile:/etc/php/cli-php5/php.iniScanforadditional.inifilesin:/etc/php/cli-php5/ext-activeAdditional.inifilesparsed:/etc/php/cli-php5/ext-active/php_gtk2.ini,/etc/php/cli-php5/ext-active/xdebug.ini To see which php.ini is used by PHP on your web server, create a file with only as the contents, and save it in your local web root as check_php.php. Open the file in your browser as http://localhost/check_php.php, to find the path to the php.ini file your web server is using. Now check PHP's include_path setting on command line: $php-c/path/to/php.ini-r'echoget_include_path()."\n";' To check PHP's include_path in your web server, create a file with only as the contents, and save it in your local web root as check_php.php. Open the file in your browser as http://localhost/check_php.php, to verify the include_path your web server is using. In every case, PEAR's php_dir should be in the include path. If not, add it in your system's php.ini. Now that this is done, try including a file. Create a new check_pear.php file with the following contents: line 108 Pages: 1 #1 2012-05-23 08:17:59 diederick76 Member From: Amsterdam Registered: 2010-02-14 Posts: 65 Website PHP: syntax error, unexpected '&' in /etc/php/php.ini on line 108 Hi all,I have a peculiar problem. My http error log show these lines repeatedly:PHP: syntax error, unexpected '&' in /etc/php/php.ini https://bbs.archlinux.org/viewtopic.php?id=142015 on line 107 PHP: syntax error, unexpected '&' in /etc/php/php.ini on line 108My /etc/php/php.ini's lines 104 through 109 are:104 ; error_reporting 105 ; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED 106 ; Development Value: E_ALL https://www.howtoforge.com/how-to-specify-a-custom-php.ini-for-a-website-apache2-with-mod_php 107 ; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT 108 109 ; html_errorsSo the &s on line 107 are to be expected, and line 108 is empty. Does anyone have any idea what's going on here?Thanks ! Offline php error #2 2012-05-23 11:47:14 XT Member Registered: 2012-05-21 Posts: 14 Re: PHP: syntax error, unexpected '&' in /etc/php/php.ini on line 108 As line 108 is empty, my first guess would be a chroot for your webserver / PHP interpreter. Is PHP really using the file you are looking at? Offline #3 2012-05-23 11:51:42 diederick76 Member From: Amsterdam Registered: 2010-02-14 Posts: 65 Website Re: PHP: syntax error, unexpected '&' in /etc/php/php.ini on line 108 It appears so. php error parsing From my phpinfo():Configuration File (php.ini) Path /etc/php Loaded Configuration File /etc/php/php.ini Scan this dir for additional .ini files /etc/php/conf.d Additional .ini files parsed (none) /etc/php/conf.d contains no files. Offline #4 2012-05-23 12:57:36 .:B:. Forum Fellow Registered: 2006-11-26 Posts: 5,819 Re: PHP: syntax error, unexpected '&' in /etc/php/php.ini on line 108 The semi-colon indicates a comment, it seems a bit strange PHP would be annoyed by random formatting in comments... After all, that's why they're comments. Are you sure there's nothing wrong higher up? Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy Offline #5 2012-05-23 13:02:52 diederick76 Member From: Amsterdam Registered: 2010-02-14 Posts: 65 Website Re: PHP: syntax error, unexpected '&' in /etc/php/php.ini on line 108 I agree there must be something going on that has little to do with the file mentioned. Even when I remove all the &s from line 107, or insert a few blank lines before line 107 (moving the supposedly wrong lines down) it still complains about &s in lines 107 and 108.But where do I look? Offline #6 2012-05-23 13:14:51 .:B:. Forum Fellow Registered: 2006-11-26 Posts: 5,819 Re: PHP: syntax error, unexpected '&' in /etc/php/php.ini on line 108 Make sure you use an editor with syntax highlighting, and go up until you find the error. Look especially close at of Bitbucket Server and get your shirt. On this page How To Specify A Custom php.ini For A Web Site (Apache2 With mod_php) 1 Preliminary Note 2 Getting Details About Your PHP Installation 3 Custom php.ini For Each Web Site 4 Links How To Specify A Custom php.ini For A Web Site (Apache2 With mod_php) Version 1.0 Author: Falko Timme This short article explains how you can specify a custom php.ini for a web site running on Apache2 with mod_php. That way, each web site can have its own php.ini instead of having to use the server's default one. I do not issue any guarantee that this will work for you! 1 Preliminary Note I'm using the web site www.example.com here with the document root /var/www/web1/web here. If you want to learn how to configure a custom php.ini for a web site using Apache + mod_fcgid + PHP, take a look at chapter 5 on http://www.howtoforge.com/how-to-set-up-apache2-with-mod_fcgid-and-php5-on-debian-etch-p2. 2 Getting Details About Your PHP Installation We will now create a small PHP file (info.php) in the document root and call it in a browser. The file will display lots of useful details about our PHP installation, such as the used php.ini file. vi /var/www/web1/web/info.php Now we call that file in a browser (e.g. http://www.example.com/info.php): As you see, the web site is currently using the /etc/php5/apache2/php.ini file. 3 Custom php.ini For Each Web Site I will copy the default php.ini (/etc/php5/apache2/php.ini on Debian/Ubuntu; /etc/php.ini on Fedora/CentOS) to the /var/www/web1/ directory and make www.example.com use the php.ini from the /var/www/web1/ directory: Debian/Ubuntu: cp /etc/php5/apache2/php.ini /var/www/web1/ Fedora/CentOS: cp /etc/php.ini /var/www/web1/ (You can now modify /var/www/web1/php.ini to your likings.) Then open the vhost configuration for the www.example.com web site and add a PHPINIDir line to it: