Results 1 to 16 of 16
  1. #1
    TravG's Avatar
    TravG is offline Private Member
    Join Date
    September 2008
    Posts
    2,069
    Thanks
    34
    Thanked 179 Times in 131 Posts

    Default WP Plugin for PHP Include Functions

    For just about all my WordPress websites I have used a Plugin named EXEC-PHP to execute php include code which I put in my pages. Now a few websites have upgraded the php version on the server and the plugin still works but is doing some weird things. For example at the top of my website it says a lot about deprecation (ex. www.usalegalcasinos.com)

    So I am looking for a new plugin which will allow me to have php files in a separate folder which I can change easily and then use those files on multiple pages throughout my website. That way when something changes I only need to change the one file and it will update on the pages I have used that particular file.

    The code I have used is <?php include(ABSPATH.'/wp-includes/phps/sloto2.php'); ?> with "sloto2.php" being the file in the other folder which I want to use on multiple, but not not all pages in my website.

    I know many other webmasters have to do the same thing I am and wondering if anyone can give me the name of a plugin that is easy to work with and I can use. I have tried several and even tried to google to find a plugin but cant find one that does what I need it to.

    Thanks
    Live Casino USA - the best USA live online casinos. Play USA online slots and other casino games like USA online blackjack. Play See USAlegalcasinos.com to find the best USA online casino. Want to play USA online poker? Find the best poker sites at 4DeucesPoker.com.

  2. #2
    universal4's Avatar
    universal4 is offline Forum Administrator
    Join Date
    July 2003
    Location
    Courage is being scared to death...and saddling up anyway. John Wayne
    Posts
    34,026
    Thanks
    4,558
    Thanked 9,310 Times in 5,991 Posts

    Default

    Since it is still working, for now you can get rid of the error, but long term you may still want to look for a more permanent solution.

    Here is an example of suppressing the deprecated errors from php
    https://www.godaddy.com/garage/suppr...ted-functions/

    You could run a simple test and try disabling the warning in one of your scripts, and if that worked you might want to go with that method for the time, so that you did not suppress other deprecated errors in case other php functions beyond these external scripts might later have an issue.

    If that seems to not work, you can suppress the errors from the php.ini file if needed. Changes in php ini file may need you to restart the site so it can read the php configuration again.

    A few additional resources that discuss it
    https://stackoverflow.com/questions/...in-runtime-php
    https://stackoverflow.com/questions/...-wamp/24559940

    Rick
    Universal4

  3. #3
    Join Date
    November 2005
    Posts
    4,507
    Blog Entries
    1
    Thanks
    1,920
    Thanked 2,216 Times in 1,278 Posts

    Default

    https://globerunner.com/why-the-word...-bad-practice/

    (unless I'm not clear on what your asking?)
    If your adding your own php custom coding, why are you even bothering with a plugin.
    Simple use the "new" php syntax, by replacing the old depreciated syntax.

    For the time being, I'd turn your php error (debug) reporting off. This will stop the errors being echoed to your screen's header.

  4. #4
    TravG's Avatar
    TravG is offline Private Member
    Join Date
    September 2008
    Posts
    2,069
    Thanks
    34
    Thanked 179 Times in 131 Posts

    Default

    Thanks Rick - where do I find the php.ini file? From what I could find it may vary with your hosting provider. Is that right? I use GoDaddy and it said about just creating your own php.ini file and uploading it to the root folder but that did not work.

    Quote Originally Posted by universal4 View Post
    Since it is still working, for now you can get rid of the error, but long term you may still want to look for a more permanent solution.

    Here is an example of suppressing the deprecated errors from php
    https://www.godaddy.com/garage/suppr...ted-functions/

    You could run a simple test and try disabling the warning in one of your scripts, and if that worked you might want to go with that method for the time, so that you did not suppress other deprecated errors in case other php functions beyond these external scripts might later have an issue.

    If that seems to not work, you can suppress the errors from the php.ini file if needed. Changes in php ini file may need you to restart the site so it can read the php configuration again.

    A few additional resources that discuss it
    https://stackoverflow.com/questions/...in-runtime-php
    https://stackoverflow.com/questions/...-wamp/24559940

    Rick
    Universal4
    Live Casino USA - the best USA live online casinos. Play USA online slots and other casino games like USA online blackjack. Play See USAlegalcasinos.com to find the best USA online casino. Want to play USA online poker? Find the best poker sites at 4DeucesPoker.com.

  5. #5
    TravG's Avatar
    TravG is offline Private Member
    Join Date
    September 2008
    Posts
    2,069
    Thanks
    34
    Thanked 179 Times in 131 Posts

    Default

    When I build websites not using wordpress I can simply type in the php code in the page I am creating and it will work. That isnt true with Wordpress. When I type the same php code into a page in WordPress it doesn't work. So I assumed I needed a plugin like exec-php to get the code to work??

    I will be the first to admit I am not the most proficient when it comes to the technical side of building websites and especially the server side of it.


    Quote Originally Posted by AussieDave View Post
    https://globerunner.com/why-the-word...-bad-practice/

    (unless I'm not clear on what your asking?)
    If your adding your own php custom coding, why are you even bothering with a plugin.
    Simple use the "new" php syntax, by replacing the old depreciated syntax.

    For the time being, I'd turn your php error (debug) reporting off. This will stop the errors being echoed to your screen's header.
    Live Casino USA - the best USA live online casinos. Play USA online slots and other casino games like USA online blackjack. Play See USAlegalcasinos.com to find the best USA online casino. Want to play USA online poker? Find the best poker sites at 4DeucesPoker.com.

  6. #6
    universal4's Avatar
    universal4 is offline Forum Administrator
    Join Date
    July 2003
    Location
    Courage is being scared to death...and saddling up anyway. John Wayne
    Posts
    34,026
    Thanks
    4,558
    Thanked 9,310 Times in 5,991 Posts

    Default

    The location of the php.ini file will be dependent on the type of hosting etc.

    One of the most accurate ways to find out what php.ini file is being read, is to drop a php info file in the root web and running it.

    Do NOT leave it there, or at least rename it to a unique name, or change the extension to .bak or .fake or something after you take a look at it.

    It is easy to create the file, just create it and upload it. The only code that needs to be in is:
    Code:
    <?php phpinfo(); ?>
    By running that file you will see a lot about the server and the environment which is why you want to remove or rename it.

    If you need help with this, just shout in a pm and let me know when the best time to contact you.


    Rick
    Universal4

  7. #7
    nwalker's Avatar
    nwalker is offline Private Member
    Join Date
    June 2013
    Location
    England
    Posts
    620
    Thanks
    196
    Thanked 456 Times in 270 Posts

    Default

    Just create the PHP as a shortcode and put it in your Functions.php file. then just put the short code where ever you want to use it. No need to use Plugins.
    Sold www.livecasinocomparer.com in April 2025 - Now retired

  8. The Following User Says Thank You to nwalker For This Useful Post:

    Former Member 14 (27 January 2020)

  9. #8
    Join Date
    November 2005
    Posts
    4,507
    Blog Entries
    1
    Thanks
    1,920
    Thanked 2,216 Times in 1,278 Posts

    Default

    Quote Originally Posted by universal4 View Post
    By running that file you will see a lot about the server and the environment
    But it's not going to do the OP much good, because the site in question, is on "shared" hosting.

    Shared hosting is fine if 'one size fits all' meets your requirements. But... if the time arises (and it usually does at some point) when you need access to php.ini or other server files which allow for customization, that's where having a VPS is advantageous. If your not comfortable or savvy with kernel updates, patches etc., etc., you can have it fully managed.

    Thought I'd add that Travis to give you some food for thought
    Last edited by Former Member 14; 27 January 2020 at 3:13 am.

  10. #9
    baldidiot is offline Private Member
    Join Date
    January 2010
    Posts
    5,098
    Thanks
    433
    Thanked 2,333 Times in 1,555 Posts

    Default

    Travis - what are you actually trying to do with the code?
    onlinegamblingwebsites.com - Formally known as goodbonusguide.

    Gambling Domains: Small clear out of some of the domains we've been hoarding - see the spreadsheet here.

  11. #10
    universal4's Avatar
    universal4 is offline Forum Administrator
    Join Date
    July 2003
    Location
    Courage is being scared to death...and saddling up anyway. John Wayne
    Posts
    34,026
    Thanks
    4,558
    Thanked 9,310 Times in 5,991 Posts

    Default

    Many hosts handle this differently.

    Some hosts allow you to do some configurations of php in cpanel, but for more advanced settings you can create a php.ini file in the public html folder if it does not already exist, or the php info file does not indicate a different location you have access to. Here is a few examples of how to do that at namecheap or inmotion on their shared hosting, although other providers may do it slightly different.

    https://www.namecheap.com/support/kn...shared-servers
    https://www.inmotionhosting.com/supp...-php-settings/

    There are also some hosts that you can configure the php environment to a degree in htaccess.

    By running the php info file you can have an immediate indication of where the configurations for php are stored, and also allows you to verify any changes you make are active. (when making php ini changes, it is a good idea to restart the site)

    Rick
    Universal4

  12. The Following User Says Thank You to universal4 For This Useful Post:

    Cash Bonus (27 January 2020)

  13. #11
    Join Date
    November 2005
    Posts
    4,507
    Blog Entries
    1
    Thanks
    1,920
    Thanked 2,216 Times in 1,278 Posts

    Default

    Quote Originally Posted by universal4 View Post
    (when making php ini changes, it is a good idea to restart the site)
    Lets put this down to curious minds would like to know... But how does one restart (or reboot) a shared hosting server?

    I haven't used "shared" hosting for literally years and years. Then again, maybe that option is available in cPanel now on "shared" hosting, IDK.

  14. #12
    universal4's Avatar
    universal4 is offline Forum Administrator
    Join Date
    July 2003
    Location
    Courage is being scared to death...and saddling up anyway. John Wayne
    Posts
    34,026
    Thanks
    4,558
    Thanked 9,310 Times in 5,991 Posts

    Default

    You are right Dave, in that it depends on what kind of shared hosting it is.

    In the case of a virtual, you most often have root access of a server that is shared on a parent Virtual host.

    Depending on the host you use and what they offer in cpanel or WHM, some cpanel setups allow you to restart your http services, which may affect all your sites momentarily, but this type f service restart is usually very fast.

    If you have SSH access you most likely can restart apache that way.

    Here are a few articles that touch on apache, server or services restart.
    https://www.inmotionhosting.com/supp...art-my-server/
    https://www.sitepoint.com/community/...-server/6278/2
    https://www.psychz.net/client/questi...in-cpanel.html

    If you are on windows, just go into IIS and select the site in the left panel, then in the right panel under actions, look for Restart under "Manage Website"

    In some cases you may have to contact your host's tech support and ask them to do it for you if you do not have other options.

    Rick
    Universal4

  15. #13
    TravG's Avatar
    TravG is offline Private Member
    Join Date
    September 2008
    Posts
    2,069
    Thanks
    34
    Thanked 179 Times in 131 Posts

    Default

    IN short, I am trying to get php code which is already in my website to work. For example, I have a php file for each casino I have a review for. In this file I have a logo, some quick bullet points about the casino, bonus info, ect. Then when I list casinos on different pages I can just enter my php code for each casino I want to display and it pull that php file (which has the logo, bullet points etc) So I will use the same php code many times throughout the website, basically anywhere I want to list a particular casino.

    I did it this way so if the bonus changes I can just change the one php file and it will update on every page I have that file instead of manually going into each page and updating it. Hopefully that makes sense.

    I have found a plugin where I can create a shortcode for my php code and then enter that shortcode on all the pages I want that php code to render. So this plugin does what I am looking for kind of. The only drawback is I already have the php code on all of my pages so I will have to manually go to every page and update it with the shortcode instead of just using the existing php code.

    For example, below is the code I would use to list BetOnline as a casino on many different pages. In the page editor I could just use this code and it would pull my file named "betonline2.php"

    <?php include(ABSPATH.'/wp-includes/phps/betonline2.php'); ?>


    Quote Originally Posted by baldidiot View Post
    Travis - what are you actually trying to do with the code?
    Live Casino USA - the best USA live online casinos. Play USA online slots and other casino games like USA online blackjack. Play See USAlegalcasinos.com to find the best USA online casino. Want to play USA online poker? Find the best poker sites at 4DeucesPoker.com.

  16. #14
    nwalker's Avatar
    nwalker is offline Private Member
    Join Date
    June 2013
    Location
    England
    Posts
    620
    Thanks
    196
    Thanked 456 Times in 270 Posts

    Default

    Quote Originally Posted by TravG View Post
    IN short, I am trying to get php code which is already in my website to work. For example, I have a php file for each casino I have a review for. In this file I have a logo, some quick bullet points about the casino, bonus info, ect. Then when I list casinos on different pages I can just enter my php code for each casino I want to display and it pull that php file (which has the logo, bullet points etc) So I will use the same php code many times throughout the website, basically anywhere I want to list a particular casino.

    I did it this way so if the bonus changes I can just change the one php file and it will update on every page I have that file instead of manually going into each page and updating it. Hopefully that makes sense.

    I have found a plugin where I can create a shortcode for my php code and then enter that shortcode on all the pages I want that php code to render. So this plugin does what I am looking for kind of. The only drawback is I already have the php code on all of my pages so I will have to manually go to every page and update it with the shortcode instead of just using the existing php code.

    For example, below is the code I would use to list BetOnline as a casino on many different pages. In the page editor I could just use this code and it would pull my file named "betonline2.php"

    <?php include(ABSPATH.'/wp-includes/phps/betonline2.php'); ?>
    If I was doing this i'd turn each php file into a shortcode in it's own right, so then i'd enter on the page where i wanted it to display [betonline2]. then i'd use the Better Search and Replace plugin to find the string you've included above and replace it with the new short code.

    Some info on short codes https://torquemag.io/2017/06/custom-shortcode/

    i can send you an example of a date shortcode i wrote so you can see what code to add to make it a short code.

    You will have to amend all the php files, but once you've done that you wont have to rely on any plugins to display your php. I took this route as the plugin i was using changed so much it became unusable.
    Sold www.livecasinocomparer.com in April 2025 - Now retired

  17. #15
    baldidiot is offline Private Member
    Join Date
    January 2010
    Posts
    5,098
    Thanks
    433
    Thanked 2,333 Times in 1,555 Posts

    Default

    Quote Originally Posted by TravG View Post
    IN short, I am trying to get php code which is already in my website to work. For example, I have a php file for each casino I have a review for. In this file I have a logo, some quick bullet points about the casino, bonus info, ect. Then when I list casinos on different pages I can just enter my php code for each casino I want to display and it pull that php file (which has the logo, bullet points etc) So I will use the same php code many times throughout the website, basically anywhere I want to list a particular casino.
    That's what I figured you were probably doing. Tbh there are simpler (and more flexible) ways of doing it rather than using php files.

    As Neil said shortcodes would be better imo. There are shortcode builder plug ins that don't require php knowledge if you want something really simple and easy to use.

    Taking your idea and expanding on it if you use shortcodes you can pass parameters through and use that to vary the content that's being output.

    To go one step further the info could be contained in custom fields - ie: a field for the logo, another for the bonus and so on - which you then output using shortcodes. Much more flexible and user friendly.
    onlinegamblingwebsites.com - Formally known as goodbonusguide.

    Gambling Domains: Small clear out of some of the domains we've been hoarding - see the spreadsheet here.

  18. #16
    DaftDog's Avatar
    DaftDog is offline Private Member
    Join Date
    October 2008
    Location
    South Africa
    Posts
    2,166
    Thanks
    698
    Thanked 779 Times in 467 Posts

    Default

    Have you tried using Reusable Blocks in the Gutenberg editor?

  19. The Following User Says Thank You to DaftDog For This Useful Post:

    universal4 (6 February 2020)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •