Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I wanted to know which php version I am using so I wrote the standard script:
php
phpinfo();
Which gives me
PHP version 5.6.10
The correct PHP version needed for my application. When I tried in terminal:
php -i
or
php -v
It shows me:
PHP version 5.3.2
Which I don’t need. Then I tried with:
which php
/usr/bin/php
Now I am confused which version of PHP I am using. The files are uploaded to the hosting website and I cannot make any changes to the config files like httpd.conf or php.ini.
httpd.conf
php.ini
Don’t panic! If you are concerned about what PHP version your Apache server is using, the output of phpinfo() is always what you should pay attention to. The Apache PHP module and the PHP command line binary are two different things that don’t interfere with each other.
phpinfo()
In fact you can compile and load various PHP versions">versions you want to work with Apache as long as you adjust Apache to properly load it. The PHP command line interface will never come into play in the case of Apache parsing PHP pages.
The command line version of PHP is simply there for command line specific tasks and the PHP module for Apache will never touch, use or need that.
You say this:
I wanted to know which php version I am using so I wrote the standard script: phpinfo(); Which gives me PHP version 5.6.10- the correct PHP version needed for my application. When I tried in terminal: php -i or php -v It shows me PHP version 5.3.2 which I don’t need.
Which gives me PHP version 5.6.10- the correct PHP version needed for my application. When I tried in terminal:
php -i or php -v
It shows me PHP version 5.3.2 which I don’t need.
The version of PHP available from the command line has 100% nothing to do with the version of PHP loaded as a module. These are completely separate things.
So if you are concerned about which version of PHP your web application is using, if phpinfo()shows version 5.6.10 and that is what you want/need that is 100% fine.
The command line version of PHP is a completely separate system item. So the only thing that matters is the output of phpinfo().
If for some reason you wanted to use a different version of PHP with Apache, all you need to do is install the compiled Apache PHP module somewhere and add—or adjust—this line in your system’s Apache config:
LoadModule php5_module /path/to/php/and/the/module/for/apache2/libphp5.so
And just adjust the path to the libphp5.so—which is what Apache uses to parse PHP—then restart Apache and you are in business.
libphp5.so
For example, at one point I had to compile PHP version 5.1.6 from source (with GD library support) for use on an Ubuntu 12.04 machine running PHP 5.3.5. In the server’s PHP module loading file here:
/etc/apache2/mods-available/php5.load
I had lines like this:
# LoadModule php5_module /usr/lib/apache2/modules/libphp535.so LoadModule php5_module /usr/lib/apache2/modules/libphp516-gd.so
Note how one line is commented out for libphp535.so and the other one for libphp516-gd.so is uncommented? What I did is I renamed the default PHP 5.3.5 libphp5.so Apache module to libphp535.so with the version number in the name so I could have it there for reference and then named the PHP 5.1.6 (with GD library support) module libphp516-gd.so so I know what that is as well. This way I have them both available to me side-by-side on the system.
libphp535.so
libphp516-gd.so
And—like I said at the outset—the PHP version used in the command line has utterly nothing to do with the Apache PHP module. So you can have any number of different versions">versions of Apache PHP modules sitting on the system ready to go; just adjust a config and restart Apache and you should be all in business to use whatever PHP version you specified Apache should use.
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 10 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 9 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.